View previous topic :: View next topic |
Author |
Message |
yertnamreg1218 Guest
|
Internal Clock Enable |
Posted: Thu Jan 31, 2008 2:38 pm |
|
|
I'm trying to use a 18f4620 to do some stuff (what it is isn't all that important). I'm trying to set the fuses properly so that the internal 8 Mhz oscillator is used. I've looked through the .h file and can't for the life of me find anything in the fuses that enables this clock. Should I just not set a fuse and use setup_oscillator(OSC_8MHZ) or something else??
Also Is there somewhere where all of the fuses (their abbreviations) are documented?? I can figure most of them out, but some are a little cryptic.
Thanks for the help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 31, 2008 3:38 pm |
|
|
Quote: |
I've looked through the .h file and can't for the life of me find
anything in the fuses that enables this clock. |
Either of these two fuse settings shown in bold will do it.
Quote: | WRTC,NOWRTC,WRTB,NOWRTB, INTRC_IO, INTRC, FCMEN,NOFCMEN |
Here is a test program that will blink an LED on pin B0.
It sets up the internal oscillator to run at 8 MHz.
Code: |
#include <18F4620.h>
#fuses INTRC_IO,NOWDT,BROWNOUT,PUT,NOLVP,NOPBADEN
#use delay(clock=8000000)
//=============================
void main(void)
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
}
|
|
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Thu Feb 21, 2008 10:48 am |
|
|
Now say for arguments sake, that I use version 3.191 of the compiler, and those key words are not recognized, what is the correct procedure to use the internal oscillator? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 21, 2008 11:52 am |
|
|
Post your PIC. Is it the 18F4680 ? |
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Thu Feb 21, 2008 3:38 pm |
|
|
sorry.. forgot to mention that it is an old board with an 18F6621 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 21, 2008 3:43 pm |
|
|
The 18F6621 doesn't have an internal RC oscillator. Here are the
oscillator options from the data sheet:
Quote: |
The PIC18F6525/6621/8525/8621 devices can be
operated in twelve different oscillator modes.
1. LP Low-Power Crystal
2. XT Crystal/Resonator
3. HS High-Speed Crystal/Resonator
4. RC External Resistor/Capacitor
5. EC External Clock
6. ECIO External Clock with I/O pin enabled
7. HS+PLL High-Speed Crystal/Resonator with PLL enabled
8. RCIO External Resistor/Capacitor with I/O pin enabled
9. ECIO+SPLL External Clock with software controlled PLL
10. ECIO+PLL External Clock with PLL and I/O pin enabled
11. HS+SPLL High-Speed Crystal/Resonator with software control
12. RCIO External Resistor/Capacitor with I/O pin enabled |
|
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Thu Feb 21, 2008 3:52 pm |
|
|
I guess that could explain it :o\
I know it is an older chip, but I figured it would be more or less the same as the 6622, which is the closest datasheet I could find, and it had the internal oscillator.
Time to order new samples. |
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Thu Feb 21, 2008 3:58 pm |
|
|
Hmm.. looking at the overview, the 6520 has an internal oscillator, yet looking at the valid fuses for it in PCW, it does not seem like it does. Strange. reason for looking at it, is that I found one in my parts bin . I also found some 6720's. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 21, 2008 4:05 pm |
|
|
Download the 18F6520 data sheet.
http://ww1.microchip.com/downloads/en/DeviceDoc/39609b.pdf
Look on page 23 in the Acrobat reader, at this section:
Quote: | 2.0 OSCILLATOR
CONFIGURATIONS
2.1 Oscillator Types |
There are no internal oscillators. Everything is external. |
|
|
Kasper
Joined: 14 Jan 2004 Posts: 88 Location: Aurora, Ontario, Canada
|
|
Posted: Fri Feb 22, 2008 7:54 am |
|
|
yeah.. i must have been cross eyed looking at the overview page. I ordered some samples of the 6722, which is one of few processors supported by my old compiler, which still has internal oscillator. Thanks |
|
|
|