/* This is a "Hello world" example for the dsPIC30F2020. 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 slow internal 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. Don't forget to
* put some 0.1uF bypass capacitors across the power pins close to the PIC.
*/
#include <p30f2020.h>
_FOSC(CSW_FSCM_OFF & FRC_LO_RANGE & OSC2_IO); //Oscillator Configuration
_FOSCSEL(FRC); //Oscillator Selection
_FWDT(FWDTEN_OFF); //Turn off WatchDog Timer
_FGS(CODE_PROT_OFF); //Turn off code protect
_FPOR( PWRT_OFF ); //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;
TRISD = 0;
TRISE = 0;
TRISF = 0;
while(1)
{
for( x=0; x<100000; x++){;} //Delay apx 200ms
LATA = ~LATA; //Toggle all bits on ALL ports
LATB = ~LATB;
LATD = ~LATD;
LATE = ~LATE;
LATF = ~LATF;
}
return 0;
}