Here is a simple hello world code for a dsPIC33FJ64MC802. You'll have to modify the code a bit for the dsPIC33fj256; such as the config bits etc, but you can see how simple it is using the C30 compiler from MicroChip:
Code:
/* This is a "Hello world" example for the dsPIC33FJ64MC802. It will toggle all
* IO pins on the chip at a rate which is visible from a LED connected to
* one of the IO pins. It uses the internal RC oscillator so all that is
* needed is a 10K pullup resistor on MCLR (pin 1 on a 28 pin DIP chip) and
* power connected to ALL Vdd, Vss, AVdd, and AVss pins. Connect a 10uF, low ESR,
* capacitor between VddCore (pin 20 on a 28 pin DIP chip) and ground. Do NOT
* connect VddCore to 3.3V! Don't forget to put some 0.1uF bypass capacitors
* across the power pins close to the PIC.
*/
#include <p33FJ64MC802.h>
_FOSC(OSCIOFNC_ON & FCKSM_CSDCMD & POSCMD_NONE); //Oscillator Configuration
_FOSCSEL(FNOSC_FRC); //Oscillator Selection
_FWDT(FWDTEN_OFF); //Turn off WatchDog Timer
_FGS(GCP_OFF); //Turn off code protect
_FPOR( FPWRT_PWR1 ); //Turn off power up timer
int main(void)
{
unsigned long x;
ADPCFG = 0xffff; //make ADC pins all digital
TRISA = 0; //Make all PORTs all outputs
TRISB = 0;
while(1)
{
for( x=0; x<73800; x++){;} //Delay apx 200ms
LATA = ~LATA; //Toggle all bits on ALL ports
LATB = ~LATB;
}
return 0;
}