View previous topic :: View next topic |
Author |
Message |
martind1983
Joined: 22 Mar 2013 Posts: 16
|
Problem with configuration bits setting in MPLAB |
Posted: Wed Jul 31, 2013 4:52 am |
|
|
Hi
I have an issue. I use MPLAB IDE v8.89 and CCS compiler v4.140.
I started working with PIC16F1826 MCU.
When I set configuration bits through code by using #fuses directive it doesn't want to set XT oscillator as I have it set in my code
setting of fuses in my application
#fuses XT, NOWDT, PUT (when I program it as final application after debugging), NOPROTECT, NOCPD, NOBROWNOUT, NOIESO, NOFCMEN, WRT, NOSTVREN, NODEBUG, NOLVP
,but MCU always starts working with default internal oscillator (500kHz) it sets OSFIF bit in PIR2 register. It means there was an error of external crystal so MCU switches clock for using of internal oscillator. But these features I have switched off through configuration bits in my code.
But when I set configuration bits through "Configure bits" window directly in MPLAB it works perfect.
I already tried to debug application to figure this problem out. But each time when I use configuration bits set in my code and I program device in debug mode (#fuses NOPUT and DEBUG are set) MPLAB always asks me, that there is enabled Power Up reset (but in code is used NOPUT)and if PICkit3 can switch it off. So I have feeling, that configuration bits in my code are not programmed into the MCU. But why is this problem?
Thank you very much for your help. Martin |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Wed Jul 31, 2013 5:15 am |
|
|
Here's something you can try...
Inside MPLAB there are two 'build configurations' available, 'debug' and 'release'. The default is set to 'debug'. You need to change this to 'release'. Versions > 8.5 should allow you to set the default (previous versions always forced 'debug' everytime !).
This may solve your problem, if not, post a very small compilable program that shows the problem, so others can 'cut&paste' and work on it.
hth
jay |
|
|
martind1983
Joined: 22 Mar 2013 Posts: 16
|
|
Posted: Wed Jul 31, 2013 6:05 am |
|
|
Thanks temtronic.
I know, that there is such possibility. But I don't know why maybe due to C plug-in in MPLAB it is not active. Checkbox is grey without possibility of changing purpose of your application either as "debug" or "release. Maybe it just works for assembler. I cannot even set it through "Project -> Build Configuration menu. There is also grey field. I think, that the problem can any bug either in MPLAB or CCS plugin. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Wed Jul 31, 2013 9:18 am |
|
|
hmm..grey boxes aren't correct !!
I use MPLAB IDE version 8.86 ( no need to upgrade...) as it's stable.
Sounds like you need to reinstall, be sure to use the correct sequence though. It's somewhere on the CCS website, about plugin, etc.
It's be a few years since I did mine.....
Best to backup everything to another folder, just in case....., then install using the defaults.
hth
jay |
|
|
martind1983
Joined: 22 Mar 2013 Posts: 16
|
|
Posted: Thu Aug 01, 2013 2:17 am |
|
|
Temtronic the issue is solved. I do not exactly how. Maybe it helped to reinstall both MPLAB IDE and CCS compiler. Or changing of MPLAB IDE to older version v8.66 as you wrote, that you use helped me. But right now it already writes config bits from code into MCU. Thanks for your advices.
Martin |
|
|
|