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

question about different speeds on a pic18f452

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



Joined: 15 Jul 2005
Posts: 59

View user's profile Send private message

question about different speeds on a pic18f452
PostPosted: Tue Jul 26, 2005 7:58 am     Reply with quote

Hi all,

I'm working on a 18f452, and it comes with 8 different oscillator modes (lp, xt, hs, hs+pll, rc, rcio, ec and ecio). These range from 455kHz ~ 25mHz. I am currently using XT (4Mhz) because, well, thats what I am using!

Can someone explain to me why I would not always want to use the fastest speed? I'm assuming thats it got to do with heat and power, faster=more power used/needed, low=less power etc...

Also, when using the "#use delay(clock=4000000)", does that have to 100% match with the osc used? I am using a 4mHz osc, so I have the clock set to 4,000,000...

Just trying to get a better understanding of this

Thanks!

~Kam (^8*
Very Happy
Ttelmah
Guest







PostPosted: Tue Jul 26, 2005 8:07 am     Reply with quote

More speed, means more power consumed, and more RF noise. Both are significant factors in designs. For a battery operated system, you may well want to run at very slow frequencies (like 32768Hz), which are nice and easy for timing calculations, and keep consumption to a minimum.
The #use delay statement, tells the compiler how fast the chip is running, and nothing else. This is used for calculations of the baud rates in serial communications, and the number of loops to be used for timings (delay_us, delay_ms etc.).
In your case, you could for instance select the hs+pll mode in the fuses, and change the #use delay to 16MHz. The chip would run 4* as fast (the PLL generates an internal clock at four times the external oscillator frequency), external RF from the oscillator would remain the same, since it only runs as 4Mhz, while there would be a slight increase in power consumption, and RF noise from the chip itself.

Best Wishes
kam



Joined: 15 Jul 2005
Posts: 59

View user's profile Send private message

fuses...
PostPosted: Tue Jul 26, 2005 8:28 am     Reply with quote

Thanks for the info! makes sense...

Now...I looked at setting my speed to HS+PLL, and I could not find a fuse to do this, I can find the HS, but not HS+PLL

Here are all the fuses as listed in the h file

Code:

//////// Fuses: LP,XT,HS,RC,EC,EC_IO,H4,RC_IO,PROTECT,NOPROTECT,OSCSEN
//////// Fuses: NOOSCSEN,NOBROWNOUT,BROWNOUT,WDT1,WDT2,WDT4,WDT8,WDT16,WDT32
//////// Fuses: WDT64,WDT128,WDT,NOWDT,BORV20,BORV27,BORV42,BORV45,PUT,NOPUT
//////// Fuses: CCP2C1,CCP2B3,NOSTVREN,STVREN,NODEBUG,DEBUG,NOLVP,LVP,WRT
//////// Fuses: NOWRT,NOWRTD,WRTD,NOWRTB,WRTB,WRTC,NOWRTC,CPD,NOCPD,CPB
//////// Fuses: NOCPB,EBTR,NOEBTR,EBTRB,NOEBTRB


I currently have:

Code:

#fuses XT,NOWDT,NOPROTECT,NOLVP


Any thoughts?

~Kam (^8*
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Jul 26, 2005 8:37 am     Reply with quote

H4
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
kam



Joined: 15 Jul 2005
Posts: 59

View user's profile Send private message

thanks!
PostPosted: Tue Jul 26, 2005 8:56 am     Reply with quote

Thanks for the info!

~Kam (^8*
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