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 CCS Technical Support

internal oscillator block PIC18F2480

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








internal oscillator block PIC18F2480
PostPosted: Fri Sep 22, 2006 7:20 pm     Reply with quote

hello,
I am using a PIC18F2480. I'd like to use the internal oscillator @ 8MHZ. I can't seem to get it to oscillate. Any suggestions on the code? I'm confused about the proper #fuse to include. also the setup_oscillator function is kind of vague in the book.

Any help would be appreciated
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Fri Sep 22, 2006 7:47 pm     Reply with quote

Try this
Code:
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#fuses NOLVP,NOWDT,NOPUT,NOBROWNOUT,NOCPD,NOWRT,NOEBTR,NOPROTECT
#use delay(clock=8000000)

void main()
{


   setup_oscillator(OSC_8MHZ);
while(1);
}
skenn_ie



Joined: 16 Oct 2006
Posts: 1
Location: Ireland

View user's profile Send private message

PostPosted: Mon Oct 16, 2006 6:20 pm     Reply with quote

I'm having a similar problem. Tried the code suggested, but still no clock.
How should this code appear in the "device configuration" bits of the programmer software ? I'm using an 18F2620, and WinPic
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Wed Oct 18, 2006 3:16 am     Reply with quote

Is there a setup directive built in to CCS for the osctune register? If not you're going to have to set the internal osc PLL bits somthing like this.

Code:

#byte osctune=0xF9B

setup_oscillator(OSC_8MHZ);
osctune = 0b1100000;    // PLL ON, center freq.

Ttelmah
Guest







PostPosted: Wed Oct 18, 2006 4:46 am     Reply with quote

It would help, first of all, if you said what compiler version?.
The 'setup_oscillator' call, should set the oscillator up correctly. It also should probably be unneccessary. The latter compilers, if the 'use delay' statement, is on the very next line after the fuses, will automatically set the oscillator up. However this should not matter, having the chip setup 'twice', should make no difference. I'd tend to 'err' to adding this as a safety feature. Smile
On Douglas's 'demo' code, how are you ever going to 'know' that the code as shown is working or not?. There is no output going to occur anywhere to actually test what is happening. Adding a pulse output in the while, would prove just what speed the chip is running.
One thing that would stop the chip waking up, would be if 'the MCLR line is not connected, and the 'NOMCLR' fuse has not been set. The chip will not start, till this pin goes high, unless the pin is disabled.

Best Wishes
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