![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
jameshdx80
Joined: 17 Mar 2017 Posts: 8
|
Configuration bits in MPLAB vs CCS |
Posted: Tue May 16, 2017 1:22 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 16, 2017 6:17 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9178 Location: Greensville,Ontario
|
|
Posted: Tue May 16, 2017 7:14 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19384
|
|
Posted: Wed May 17, 2017 1:23 am |
|
|
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.... |
|
![](templates/subSilver/images/spacer.gif) |
jameshdx80
Joined: 17 Mar 2017 Posts: 8
|
|
Posted: Wed May 17, 2017 1:10 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|