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

CONFIG1H.FOSC<3:0> #fuses not working

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



Joined: 16 Sep 2013
Posts: 5

View user's profile Send private message

CONFIG1H.FOSC<3:0> #fuses not working
PostPosted: Thu Nov 21, 2013 10:22 am     Reply with quote

Setup:
* I am using: PIC18LF46K22.
* I am using compiler version 4.128
* I build from in MPLab 8.84

Problem:
I am trying to set the:
CONFIG1H.FOSC<3:0>: Oscillator Selection bits
... but can't get it to work

I tried doing this two ways:
1) Through code - I check the "Configuration bits set in code" in MPLAB and then recompile with different #fuses (INTRC_IO, INTRC, LP, ...).
2) Through MPLAB - Configure->Configuration Bits dialog.

...then I check the hex file produced by the build, but it always has the same CRC.


I see from this post:
http://www.ccsinfo.com/forum/posting.php?mode=newtopic&f=1

“Don't compile with the "Build Configuration" in MPLAB set to "DEBUG".
The PROTECT, WDT, BROWNOUT, and maybe some other fuses are
automatically disabled for Debug mode.”

However, my ‘Build Configuration’ is set to ‘RELEASE’.


I also did some tests where I look at the .hex file after compiling with other #fuses changed. These do indeed change the build output.

Build1
//CONFIG1H.PLLCFG:
#fuses PLLEN
//#fuses NOPLLEN
:0E0000000018173800A081000FC00FE00F405D
:00000001FF
;PIC18LF46K22
;CRC=27E3 CREATED="20-Nov-13 18:16"

Build2
//CONFIG1H.PLLCFG:
//#fuses PLLEN
#fuses NOPLLEN
:0E0000000008173800A081000FC00FE00F406D
:00000001FF
;PIC18LF46K22
;CRC=B821 CREATED="21-Nov-13 10:46"

Build3
//CONFIG3H.CCP2MX
//#fuses CCP2B3
#fuses CCP2C1
:0E0000000018173800A181000FC00FE00F405C
:00000001FF
;PIC18LF46K22
;CRC=8544 CREATED="21-Nov-13 10:50"

Can someone tell me why CONFIG1H.FOSC<3:0> #fuses settings have no effect?


temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 21, 2013 2:56 pm     Reply with quote

any chance you've got ICD set to true or yes ?

I like the 46k22, always set fuses within the program not by MPLAB and have never had any problems....

hth
jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 22, 2013 12:15 am     Reply with quote

Until you post a test program, nothing much can happen, because we don't
know what you're doing. If you don't post one, then we have write one
and it won't match your problem.

For example, I install vs. 4.128 and compile this program:
Code:

#include <18LF46K22.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT, NOPLLEN
#use delay(clock=4M)
//===================================
void main()
{

while(1);
}


Quote:

:1000000002EF00F0F86AD09EEA6AE96A500ED36EF9
:100010009B9C9B9E0101886BC150F00BC16E000E32
:100020000F01386F3C6F396F3A6F3B6F776A786AB0
:06003000796AFFD703000E
:020000040030CA
:0E00000000E81E3C00BF81000FC00FE00F4063
:00000001FF
;PIC18LF46K22
;CRC=58AE CREATED="21-Nov-13 22:12"


Then I comment out the NOPLLEN and re-compile:
Code:
#include <18LF46K22.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT  //, NOPLLEN
#use delay(clock=4M)
//======================================
void main()
{

while(1);
}


And the CRC is different:
Quote:

:1000000002EF00F0F86AD09EEA6AE96A500ED36EF9
:100010009B9C9B9E0101886BC150F00BC16E000E32
:100020000F01386F3C6F396F3A6F3B6F776A786AB0
:06003000796AFFD703000E
:020000040030CA
:0E00000000F81E3C00BF81000FC00FE00F4053
:00000001FF
;PIC18LF46K22
;CRC=31EC CREATED="21-Nov-13 22:13"

And that's not the result that you're getting.

Post a test program !
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Fri Nov 22, 2013 1:41 am     Reply with quote

It's worth saying that there are _three_ things that set you to 'DEBUG'.

1) MPLAB. Default build configuration in DEBUG, and this overrides CCS settings.
2) DEBUG fuse.
3) ICD=TRUE. Automatically sets the debug fuse.

Any of these force the debug mode to be selected. _All_ need to be turned off.

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Nov 22, 2013 6:37 am     Reply with quote

re :
1) MPLAB. Default build configuration in DEBUG, and this overrides CCS settings.

...

you can select 'RELEASE' to be the default build configuration !

If you build in 'DEBUG' mode,burn the PIC, try to run in the real world, it won't work as expected....


hth
jay
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