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

How to alter CONFIG1L bits at runtime

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







How to alter CONFIG1L bits at runtime
PostPosted: Wed Sep 14, 2005 3:58 pm     Reply with quote

Hi to everyone,

I want to change the oscillator settings at runtime, but i couldn't find a way to alter the bits of CONFIG1L and CONFIG1H. Write_program_eeprom cant do this, but read_progra_eeprom can display their contents. Does anyone know a solution to my problem.

PS: I can accept asm codes as well.

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 14, 2005 4:07 pm     Reply with quote

For what PIC ?
erothias
Guest







PostPosted: Wed Sep 14, 2005 4:26 pm     Reply with quote

Sorry, i forgot Laughing

It is 18F4550
CCS compiler version: 3.227
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 14, 2005 5:01 pm     Reply with quote

The EECON1 register has a bit, CFGS, which has to be set = 1 to
access the Configuration memory. CFGS is bit 6 in EECON1.

I compiled a test program, using the address of the Config1 register
and you can see that CCS is clearing the CFGS bit. CCS is not
checking the address to see if it's in the range of the Config bits.
To fix this I think you have to write your own routine to write to
the config memory.

A better question to ask would be, do you really need to do this ?
The 18F4550 has many oscillator options. Maybe some other
method would solve your problem ?
Code:

..... write_program_memory(0x300000, &config1, 2);   
0054:  BSF    FD0.6
0056:  BCF    FA6.6    // CFGS bit is set = 0
0058:  MOVLW  30
005A:  MOVWF  FF8
005C:  CLRF   FF7
005E:  CLRF   FF6
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