Hi: I want to get started with the PIC24 platform, and recently got a few 24HJ128GP502 chips and wrote a testing program (attached) with the C30 C compiler/MPLAB to toggle the PORTB pins quickly. I'm using a PICKit 2 (via ICSP) to program the chip, but I've been unable to run it just by powering it up and raising MCLR to Vcc. Instead, I've had to select PICKit 2 in MPLAB and then run the program in debug mode in order to see any output on the PORTB pins. The code runs flawlessly when it is in debug mode; the internal RC oscillator and PLL work correctly and I/O pins strobing at the right frequency. Right now, I'm just trying to set up the environment and figure out how to get code running, so I really don't know what's wrong with my setup. How do I run my code without having to put the chip into hardware debug? I'm using the latest versions of all software: MPLAB 8.15a C Compiler for PIC24 MCUs 3.11(b) student edition (I'm a high school student trying to get started with the PIC24 platform for doing some robot work. I had been using the 18F2550 previously, but I needed to take in lots of servo PWM input pulses and liked the convenience of hardware capture peripherals with interrupts.) Many thanks, Xo Wang /* test.c */ #include #include /*************************************************************** Config fuses */ /* Various code protections off */ _FBS(0xFFFF) _FSS(0xFFFF) _FGS(0xFFFF) /* Two-speed oscillator startup disabled, FRC oscillator w/ divide and PLL */ _FOSCSEL(FNOSC_FRCPLL & IESO_OFF) /* Multiple I/O remap, OSC2 is clock out, Primary oscillator disabled, Clock switching and clock monitor disabled */ _FOSC(FCKSM_CSDCMD & IOL1WAY_OFF & OSCIOFNC_OFF & POSCMD_NONE) /* WDT disabled */ _FWDT(0xFFFF) /* I2C mapped to SDA1/SCL1, Power-on Reset Timer Disabled */ _FPOR(ALTI2C_OFF & FPWRT_PWR1) /* Debug stuff */ _FICD(BKBUG_ON & COE_ON & JTAGEN_OFF & ICS_PGD1) /*********************************************************************** Main */ int main(void) { OSCCON = 0x1100; OSCTUN = 0x0013; /* Set FRC at 8 Mhz */ PLLFBD = 0x0026; /* PLL at 40x, bring FOSC to 40 MHz */ CLKDIV = 0x0000; /* do not divide FRC, PLL pre/post both at 1/2 */ AD1PCFGL = 0xFFFF; /* set ADC1 pins to digital */ TRISB = 0; /* configure PORTB for output */ while(1) { LATB = ~LATB; __delay32(606); } return 0; } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist