I am writing some codes related to watchdog timer. After I flashed the binary generated by the following code, it is found that there is no way for me to do flash programming anymore using Keil Ulink2. I always get errors of "Cannot enter Debug moder" in the build output and "Cannot Load Flash Programming Algorithm" will be shown in a popup error message box. Can anyone help? Thanks.
unsigned int delayInMs = 60000; void feedWatchDog() { WDFEED=0xAA; WDFEED = 0x55; } void delay(int val) { int cnt; val = (val >> 2) << 16 <<7; for (cnt = 0; cnt < val; cnt++) { feedWatchDog(); }; /* Delay */ } main() { int n; int delayVal; PINSEL1 = 0; IODIR0 = 0x00FF000; if (WDMOD & WDTOF != 0) { delayVal = 100; } else { delayVal = 10; } WDTC = delayInMs * FOSC * PLL_MUL / (VPBDIV_val * 1000); WDMOD = 3; //watchdog reset mode feedWatchDog(); while (1) { /* Loop forever */ for (n=0x00001000; n <= 0x00080000; n <<= 1) { /* Blink LED 0, 1, 2, 3, 4, 5, 6, 7 */ IOSET0 = n; /* Turn on LED */ delay(delayVal); /* Delay */ IOCLR0 = 0x00FF000; /* Turn off LEDs */ } } }