CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Internal Oscillator troubles

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Drake



Joined: 08 Dec 2005
Posts: 4

View user's profile Send private message

Internal Oscillator troubles
PostPosted: Thu Dec 08, 2005 3:58 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 4:38 pm     Reply with quote

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 ?
Drake



Joined: 08 Dec 2005
Posts: 4

View user's profile Send private message

Internal Oscillator troubles
PostPosted: Thu Dec 08, 2005 5:01 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 5:12 pm     Reply with quote

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.
Drake



Joined: 08 Dec 2005
Posts: 4

View user's profile Send private message

Internal Oscillator troubles
PostPosted: Thu Dec 08, 2005 6:40 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 6:47 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 6:57 pm     Reply with quote

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.
Drake



Joined: 08 Dec 2005
Posts: 4

View user's profile Send private message

Good call
PostPosted: Thu Dec 08, 2005 9:26 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group