londoner
Newbie level 4
I have a simple code for blinking LEDs in dsPIC30F2010. I am using MPLABX v5.20 and XC16 v1.36.
I notice the dsPIC restarts at approximately 20seconds. Please, what could be the cause? I have tried on different boards and same result.
Here is my code:
Xtal is 6MHz external. Is there something I need to turn off or on in the SFRs?
I notice the dsPIC restarts at approximately 20seconds. Please, what could be the cause? I have tried on different boards and same result.
Here is my code:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include <xc.h> #include <libpic30.h> #include <p30F2010.h> _FOSC(CSW_FSCM_OFF & XT_PLL16); _FWDT(WDT_OFF); _FBORPOR(MCLR_DIS & PWRT_OFF & PBOR_ON & BORV_27 & RST_PWMPIN & PWMxH_ACT_HI & PWMxL_ACT_HI); _FGS(CODE_PROT_OFF); void main( void ) { TRISEbits.TRISE4 = 0; TRISEbits.TRISE5 = 0; _LATE4 = 1; _LATE5 = 1; //used this to know when there is restart __delay32(2400000); _LATE5 = 0; while( 1 ) { __delay32(2400000); _LATE4 = 1 - _LATE4; _LATE5 = 1 - _LATE5; //toggle LEDs } }
Xtal is 6MHz external. Is there something I need to turn off or on in the SFRs?