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

18F45K80 switch oscillator

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



Joined: 30 Jun 2011
Posts: 3
Location: France

View user's profile Send private message

18F45K80 switch oscillator
PostPosted: Thu Jun 30, 2011 3:44 am     Reply with quote

Hello,
Can anybody help me?
I have a 18F45K80 with an external XO (16MHz) which have an enable pin.

I wish to switch to internal oscillator (31 KHz) and drive low the enable pin to shutdown the external oscillator.
Actually, the system have a huge consumption (200mA instead 60mA) when I execute this code:
Code:
 
#use delay(internal=31KHZ)
setup_oscillator(OSC_31KHZ);
setup_oscillator(OSC_INTRC);

output_low(pin_B5); //shutdown the external oscillator

What fuses should be activated?
I have INTRC_LP and IESO.


Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 01, 2011 12:14 pm     Reply with quote

Quote:
#use delay(internal=31KHZ)
setup_oscillator(OSC_31KHZ);
setup_oscillator(OSC_INTRC);


output_low(pin_B5); //shutdown the external oscillator

The setup_oscillator() function is not cumulative. You can't call it several
times sequentially and have the PIC retain each setting. The latest call to
the function overrides all previous calls.

If you need more help, then post a short but complete test program that
shows how you want to switch the oscillator speed. You could probably
do this program with no more than 10 lines in main(), including code to
blink an led to show the speed. Also post the #include for the PIC,
#fuses, #use delay(), etc. The program must compile. And most
important of all, it must be short. 10 lines max !
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