Pics not running in release mode

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Feb 23, 2012.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    I created this simple program:

    Code ( (Unknown Language)):
    1.  
    2. #include <P18F26J53.h>
    3.  
    4. #pragma config WDTEN = OFF
    5. #pragma config XINST = OFF
    6. #pragma config CFGPLLEN = OFF
    7. #pragma config OSC = INTOSCO
    8. #pragma config FCMEN = OFF
    9.  
    10.  
    11.  
    12. void main()
    13. {
    14.  
    15.     TRISBbits.TRISB3 = 0;
    16.     LATBbits.LATB3 = 0;
    17.  
    18.     while(1) LATBbits.LATB3 =~ LATBbits.LATB3;
    19.  
    20. }
    21.  
    It does noting more than toggle LATB3. It works fine in debug mode but when I compile for release and program the chip the code does now run.

    Any idea why?

    I have a 18F26J53 and a 18F27J53 and both do the same thing.
     
  2. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    You need to set the osccon setting or the chip will just set there till the oscillator starts
     
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016

    Which ones? Clock Freq? Default is 4MHZ.

    How does this explain why it works in debug but not release?
     
  4. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Got this one figured out. It was the MCLR.
     
Loading...