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

Configuration bits in MPLAB vs CCS

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



Joined: 17 Mar 2017
Posts: 8

View user's profile Send private message

Configuration bits in MPLAB vs CCS
PostPosted: Tue May 16, 2017 1:22 pm     Reply with quote

Hi!

I am using MPLAB 8.83 and PCWHD Compiler CCS 4.130 in a PIC18F4550 and everything is working fine. I was using MPLAB to set the configuration bits, but I decided to set in code.

The attached image shows what configuration bits I was using.

https://ibb.co/hUT735

Checking CCS Fuses tool I found that the corresponding fuses should be

(with MPLAB set in code option, after restarting MPLAB)
Code:

#fuses PLL5,CPUDIV2,USBDIV
#fuses HSPLL,FCMEN,NOIESO
#fuses NOPUT,NOBROWNOUT,VREGEN
#fuses NOWDT,WDT8192
#fuses CCP2C1,PBADEN,LPT1OSC,NOMCLR
#fuses NOSTVREN,NOLVP,NOXINST,NODEBUG
#fuses PROTECT,EBTRB,EBTR,WRTB,WRTD,WRTC,WRT,CPD,CPB

I compared in the Hex file the output generated by MPLAB and CCS, and strangely they do not match:

2C 4E 31 1A 00 07 80 00 00 00 00 00 00 00 A6 MPLAB
2C 4E 31 1A 00 07 00 00 0F 80 00 00 00 00 97 CCS (set in code option)

I my opinion, there should exist a CP0, CP1, etc as flags for CCS. I tried #fuses 1=0x2C4E etc and it did not work either.

I thought it would be easier, but after trying for 3 hours a configuration as simple as this, I decide to ask.

Thank in advance
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 16, 2017 6:17 pm     Reply with quote

1. Post the list of fuses given at the end of the .LST file.

2. Also post your #use delay() statement.

3. Also, tell us if the drop-down box at the top center of MPLAB is set
for Debug or Release mode. Based on your post, it's probably set for
Release, but I'd like to know anyway.
temtronic



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

View user's profile Send private message

PostPosted: Tue May 16, 2017 7:14 pm     Reply with quote

The device header file should list the available fuses.

It is possible that only a single option (protect all the boot block area) may be the option, not the 4 'sections' on an individual basis.

It's been years since I used the 4550 so I'm doing this from memory.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed May 17, 2017 1:23 am     Reply with quote

The don't match because you have left out a couple of the fuses.

For instance, the brown out reset voltage differs. This doesn't matter at all (since you have the brownout disabled), but results in the different value for the third byte. Similarly the ICSP is disabled, but mapped to port 1 in the original fuses. Also the fail safe clock monitor is enabled:

Code:

#fuses PLL5,CPUDIV2,USBDIV
#fuses HSPLL,FCMEN,NOIESO
#fuses NOPUT,NOBROWNOUT,VREGEN
#fuses NOWDT,WDT8192
#fuses CCP2C1,PBADEN,LPT1OSC,NOMCLR
#fuses NOSTVREN,NOLVP,NOXINST,NODEBUG
#fuses PROTECT,EBTRB,EBTR,WRTB,WRTD,WRTC,WRT,CPD,CPB
#fuses FCMEN BORV27 ICSP1


Gives the patterns you have in the MPLAB code.

Your direct setting didn't work, because you wanted to set configuration word zero, not 1....
jameshdx80



Joined: 17 Mar 2017
Posts: 8

View user's profile Send private message

PostPosted: Wed May 17, 2017 1:10 pm     Reply with quote

Awesome! Solved in 2 minutes... Thank you very much PCM programmer, temtronic and Ttelmah!

Fuses directives were not complete as pointed by Ttelmah and after checking .LST as suggested by PCM Programmer there was this message:

Some fuses have been forced to be compatible with the ICD debugger.

I am not using ICD... o_O

So, I clicked MPLAB->Project->Build Options->Project, CCS C compiler Tab and uncheck Compile for use with ICD Debugger.

Now the fuses are exaclty as expected.

Thanks again.
Kind Regards,
James
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