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

PIC18F4550 CONFIG register

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







PIC18F4550 CONFIG register
PostPosted: Mon Apr 07, 2008 5:25 am     Reply with quote

hey guys
i'm using mplab and icd2 programmer with my 18f4550. i have got a 20mhz oscillator and want to have 48mhz as output frequency. i have to write some values to the config1h/l registers but i don't know how to do this in c language.

this is what i would like to do:
//CONFIG1L=0x24;
//CONFIG1H=0x0E;


i'm absolutely not keen in asm, so if you have got some asm code, please write copy friendly :_)

regards
Matro
Guest







PostPosted: Mon Apr 07, 2008 6:08 am     Reply with quote

This registers, that are called "configuration registers" in the Microchip datasheets are aka "Fuses".
They are set when the device is programmed and are mapped in memory at an address that is not in the program or RAM memory.
To program them with CCS you have to use the preprocessor directive "#FUSES" followed by the fuse(s) you want to set.
If you have PCW you can see the valid fuses in the "view" tab.

Another way to do so is to directly write in ROM at the register address with the "#ROM" directive.

Matro.
Matro
Guest







PostPosted: Mon Apr 07, 2008 6:11 am     Reply with quote

Notice that the device you use have the capability of self-writing its configuration registers, using the same way as program memory writing.

For more information, look at the chapter 25.1 of the datasheet (chapter 6.5 for program memory writing).

Matro.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 07, 2008 10:43 am     Reply with quote

Quote:

I have got a 20mhz oscillator and want to have 48mhz as output frequency

I assume you mean a crystal.
The answer is in the forum archives. See this post for the fuse settings:
http://www.ccsinfo.com/forum/viewtopic.php?t=34096&start=5
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