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

Writing the Config1h Register on the PIC18F2580

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







Writing the Config1h Register on the PIC18F2580
PostPosted: Wed Oct 04, 2006 5:06 pm     Reply with quote

I am attempting to write 0110 to the Fosc3:Fosc0 bits in the Config1h register of my PIC18F2580 to enable external crystal PLL mode. In the manual on page 345 it details how to do this, but I am not completely sure how to directly write registers outside of using the #byte directive (maybe this is how I need to do it?). Setting these bits requires a special procedure similar to "programming the flash memory" according to the manual so I was wondering if someone had done this before and could give some guidance (and maybe a code snippet). Anyone able to give me some tips?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 04, 2006 5:38 pm     Reply with quote

Use the #fuses statement. Look near the top of the 18F2580.H file
for a list of settings that you can use.

Example:
Code:

#include <18F2580.h> 
#fuses H4,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=40000000)   // 10 MHz crystal x 4 = 40 MHz


Note that the power must be cycled after you program the PIC,
in order for the PLL mode to take effect.
Bryan



Joined: 23 Apr 2005
Posts: 73

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

PostPosted: Wed Oct 04, 2006 5:58 pm     Reply with quote

Is H4 fuse the HSPLL setting as described in the data sheet? Sorry, I accidentally posted as guest before, but the first post was mine as well. I still haven't been able to find a listing of what each fuse means - is this listed somewhere?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 04, 2006 7:06 pm     Reply with quote

Yes, H4 is the same as HSPLL for that PIC.

Here's the thread on #fuses.
http://www.ccsinfo.com/forum/viewtopic.php?t=24336
Humberto shows a list of fuses with explanations. I'm not sure where
that comes from. I don't know if he created it or if PCWH created it.

I do know that if you go to the View menu in the IDE and select the
"Valid Fuses" menu, you'll get a pop-up window. Then select your PIC
in the drop-down box, and you'll see a list of fuses with an explanation
next to each one. (This is for PCWH vs. 3.249. I looked at the demo).
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Oct 05, 2006 5:56 am     Reply with quote

Quote:
Humberto shows a list of fuses with explanations. I'm not sure where
that comes from. I don't know if he created it or if PCWH created it.
It looks like an abstract from the file fuses.txt in the compiler directory.
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