Program works fine in debug mode, but not in release mode - Where do I start?
So I created a very simple program that just turns on a LED. It works fine in debug mode, but does not work in release mode. I verified the code and stillno luck. I am using a PIC24 on MPLAB.
Any thoughts?
Code:
//***************************************************/
// Include Header File
//***************************************************/
#include "p24FJ128GA110.h"
//***************************************************/
int main (void)
{
//ANi as digital I/O
AD1PCFGH = 0xFFFF;
AD1PCFGL = 0xFFFF;
TRISB=0b00000000;;
while(1) //run clock
{
LATBbits.LATB6 = 1;
}
}
//end of code
I expect the problem is not in your code but in the c0 code that calls your main. It does needed setup. In C18 the file is named C018 so it may be called C024. But microchip is not very consistent.
It may be the you are linking in a version that passes control to the debugger.
Where the compiler library source files are stored.
I expect you know most of this but have have to check.
Are you using program rather then debug from the main menu to program the PIC? (expect yes)
I wonder if it is executing code?
Does it run when programmed (non debug) and still connected to the ICSP.
Does it run when programmed and removed from the ICSP.
If disconnected does it have power to the PIC?
Do you have the MCLR line tied high with a resistor ?
I have a really similar problem where an LED will light in debug mode but wont light in release mode. I have the MCLR line tied high. No capacitors on the board but the PICkit 3 diagram seems to say dont put a capacitors between Vdd and Vss. Nor does it want a cap on the PGC/PGD lines according to the info poster. I can't take it off the PICkit because that's powering it. Any help would be greatly appreciated!
Aha! Got it lol, for reference to anyone else googling this problem (as I did to find this page): setting the config in the configuration bits window of the PICkit 3 will be fine in the debug mode but hard coding it into the source file is necessary to make it run in release mode