0
Programming PIC24FJ64GB004
Hello all, I am trying to run simple LED blink program on PIC24FJ64GB004(bought from http://www.kynix.com/Detail/416542/PIC24FJ64GB004T-I-ML.html)using PICKit3 programmer.
I tried multiple codes but all give same response. When i write a 0 to GPIO it remains at logic 0, but when i write 1 to any GPIO it starts toggling.
Same behavior whatever configuration or code i try whatever GPIO i use.
Please suggest me where is the issue. Below is one of the codes i've tried but no luck. Please help me out. Thanks all.
#include <p24fxxxx.h>
_CONFIG1( JTAGEN_OFF & //JTAG port is disabled
GCP_OFF & //GSP Memory Code Protection OFF
GWRP_OFF & //GCC Flash Write Protection OFF
FWDTEN_OFF & //Watchdog Timer OFF
ICS_PGx1) //debug over PGD1 and PGC1
_CONFIG2( FNOSC_FRCPLL & //Internal FRC with PLL
OSCIOFNC_ON & //RA3 is clk out (fosc/2)
POSCMOD_NONE & //Primary oscillator disabled
I2C1SEL_PRI) //Use default SCL1/SDA1 pins
#pragma code
int main(void)
{
unsigned long i; //a 32 bit variable to use as a timer
CLKDIVbits.RCDIV0=0; //clock divider to 0
AD1PCFG = 0xFFFF; // Default all pins to digital
OSCCONbits.SOSCEN=0; //Disables the secondary oscilator
TRISAbits.TRISA1 = 0; //sets the Mode LED pin RA1 as output
LATAbits.LATA1 = 1; //turns LED ON
//////////////////////////////////////////////////////////////////
///FOREVER LOOP///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
while(1)
{
}
}
Customer support service by UserEcho