View previous topic :: View next topic |
Author |
Message |
Drake
Joined: 08 Dec 2005 Posts: 4
|
Internal Oscillator troubles |
Posted: Thu Dec 08, 2005 3:58 pm |
|
|
Hello,
Newbie to the PIC and I am having some trouble getting the internal oscillator to work on the PIC16F88. I can get an external oscillator to work fine, but really would like to use the internal. I have the following fuses set:
#use delay(clock=4000000)
#fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, BROWNOUT, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
Which were just set as standard in the PCM wizard.
Thanks in advance for any suggestions. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 08, 2005 4:38 pm |
|
|
To get the feature working, in which CCS automatically sets up the
the OSCCON register for the internal oscillator, you have to put the
#use delay() statement after the #fuses statement. Example:
Quote: | #fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, BROWNOUT, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use delay(clock=4000000) |
I have a question. Did the PCWH wizard create it with the #use delay()
statement on top ? |
|
![](templates/subSilver/images/spacer.gif) |
Drake
Joined: 08 Dec 2005 Posts: 4
|
Internal Oscillator troubles |
Posted: Thu Dec 08, 2005 5:01 pm |
|
|
Yes, by the way it did. I am using 3.203. Also, Do I still need the setup_oscillator statement in main()? Thanks for the quick reply. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 08, 2005 5:12 pm |
|
|
In your version, the CCS startup code sets the OSCCON register = 0x60.
This selects 4 MHz operation, and uses the oscillator setting specified
in the #fuses statement, which is the internal oscillator. So, you don't
have to use the setup_oscillator() statement to get into 4 MHz INTRC
mode. The CCS setup code does it for you. |
|
![](templates/subSilver/images/spacer.gif) |
Drake
Joined: 08 Dec 2005 Posts: 4
|
Internal Oscillator troubles |
Posted: Thu Dec 08, 2005 6:40 pm |
|
|
Still have a heck of a time with this thing. Nothing is happening. What are the minimum pins that I need hooked up. I have power and ground. Then I have a 1k pull up on B0 and an LED to ground through a 330 ohm and I have MCLR tied to 3.3v which is the supply. The code goes:
#include <16F88.h>
#fuses NOWDT, INTRC_IO, NOPUT, NOMCLR, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use delay(clock=4000000)
#define FOREVER 1
main(){
while(FOREVER){
output_low(PIN_B0);
delay_ms(100);
output_high(PIN_B0);
delay_ms(100);
}
}
I just want to turn the led on an off, so that I can move onwards. Greatly appreciate the help thus far. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 08, 2005 6:47 pm |
|
|
Quote: | have MCLR tied to 3.3v which is the supply. |
Are you using the "LF" version of the PIC ? According to the data sheet,
the LF version is required if you want to run at 3.3v. The regular "F"
version won't work. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 08, 2005 6:57 pm |
|
|
Also the Brownout feature can't be used at 3.3v. In the 16F88, the
Brownout voltage is fixed at 4.0v +/- 0.35v. So change your fuse
setting to NOBROWNOUT. |
|
![](templates/subSilver/images/spacer.gif) |
Drake
Joined: 08 Dec 2005 Posts: 4
|
Good call |
Posted: Thu Dec 08, 2005 9:26 pm |
|
|
Thanks for the heads up. I looked at the first page summary of the chip and had no idea that it came in an LF version. Well that should solve the problem. I'll give it a try tomorrow. Thanks a million for all your help. |
|
![](templates/subSilver/images/spacer.gif) |
|