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

Difference between debug mode and normal mode

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



Joined: 14 Sep 2021
Posts: 1

View user's profile Send private message

Difference between debug mode and normal mode
PostPosted: Tue Sep 14, 2021 8:49 pm     Reply with quote

Hello

I am programming in the MPLAB X IDE development environment
Use PIC microcomputer is PIC24FJ1024GB610.

When executed in debug mode, the LED will light up normally.
However, the LED does not light when writing hex file in normal mode.
LED control uses PIN_G13

Vdd confirmed 3.3V

What's wrong?

please help me.

Code:

#include <24FJ1024GB610.h>

#fuses NOWRTB               
#fuses NOBSS               
#fuses NOBS                  
#fuses NOWRT               
#fuses NOPROTECT            
#fuses NOWPCFG               
#fuses NOPROTECT_CFG         
#fuses NOAIVT               
#fuses NOBSS               
#fuses FRC                  
#fuses NOPLL               
#fuses NOIESO               
#fuses NOPR               
#fuses NOSOSC_SEL                     
#fuses PLL_FROM_FRC         
#fuses NOIOL1WAY            
#fuses NOCKSNOFSM            
#fuses WPOSTS16               
#fuses WDT32               
#fuses NOWDT               
#fuses WINDIS               
#fuses WDTWIN_25%            
#fuses NOWDTCMX               
#fuses WDTCLK_LPRC            
#fuses BROWNOUT               
#fuses NOLVR               
#fuses NODNVP               
#device icd=2               
#fuses NOJTAG               
#fuses NOBTSWP               
#fuses NOALTCMPI            
#fuses NOTMPRPIN            
#fuses SOSC_LOW            
#fuses VREFNORM_CVREFNORM      

#use delay(clock=8000000)

void output_init()
{
   output_low(PIN_A2);
   output_low(PIN_A3);
   output_low(PIN_A14);
   output_low(PIN_A15);
   output_low(PIN_B3);
   output_low(PIN_B4);
   output_low(PIN_B5);
   output_low(PIN_B6);
   output_low(PIN_B7);
   output_low(PIN_C1);
   output_low(PIN_C2);
   output_low(PIN_C4);
   output_low(PIN_C13);
   output_low(PIN_C14);
   output_low(PIN_C15);
   output_low(PIN_D1);
   output_low(PIN_D2);
   output_low(PIN_D3);
   output_low(PIN_D4);
   output_low(PIN_D5);
   output_low(PIN_D6);
   output_low(PIN_D7);
   output_low(PIN_D8);
   output_low(PIN_D9);
   output_low(PIN_D10);
   output_low(PIN_D11);
   output_low(PIN_D12);
   output_low(PIN_D13);
   output_low(PIN_D14);
   output_low(PIN_D15);
   output_low(PIN_E0);
   output_low(PIN_E1);
   output_low(PIN_E2);
   output_low(PIN_E3);
   output_low(PIN_E4);
   output_low(PIN_E5);
   output_low(PIN_E6);
   output_low(PIN_E7);
   output_low(PIN_E8);
   output_low(PIN_E9);
   output_low(PIN_F0);
   output_low(PIN_F1);
   output_low(PIN_F4);
   output_low(PIN_F5);
   output_low(PIN_F8);
   output_low(PIN_G0);
   output_low(PIN_G1);
   output_low(PIN_G2);
   output_low(PIN_G3);
   output_low(PIN_G8);
   output_low(PIN_G9);
   output_low(PIN_G12);
   output_low(PIN_G13);
   output_low(PIN_G14);
   output_low(PIN_G15);
}

void initialize()
{
   setup_oscillator(OSC_INTERNAL, 8000000);

   output_init();

   set_tris_a(0x0000);
   set_tris_b(0x0000);
   set_tris_c(0x0000);
   set_tris_d(0x0000);
   set_tris_e(0x0000);
   set_tris_f(0x0000);
   set_tris_g(0x0000);

   output_init();

}

void main()
{
   static int cnt=0;
   static int flg=0;

   initialize();

   while(1)
   {
      cnt++;
      if(cnt>=10000)
      {
         cnt=0;
         flg^=1;
         output_bit(PIN_G13,flg);
      }
   }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed Sep 15, 2021 1:34 am     Reply with quote

What is on your MCLR pin?.
This needs a pull up resistor.
When in DEBUG mode, this pin is controlled by the debug hardware. When
in release mode, you need to pull it up. 22K to the supply.
What version of MPLAB X?. There have been (several) issues with particular
versions not correctly handling this on particular chips.
I would get rid of _all_ your clock setup fuses. You have several that seem
to conflict with one another. Just use #use delay to select the clock:

#use delay(internal=8MHz)
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