Texas Instruments MSC1210 User Manual

Page 243

Advertising
background image

Watchdog Timer

17-15

Keil Simulator

/*start short loop to test DWDT*/

for (i = 0; i < 4000; i ++)

{//idle delay

j = (i *13) % 4000;

}

//Disable watchdog timer before timer expires

WDTIMER |= 0x40;

WDTIMER &= ~0x40;

//Reinitialize watchdog, sinice it has just been disabled

init_watchdog ( );

/*start short loop to test RWDT*/

for (i = 0; i < 400; i ++)

{//idle delay

j = (i *13) % 4000;

}

/*Reset Watchdog Timer before Watchdog Timer Expires*/

WDTIMER |= 0x20;

WDTIMER &= ~0x20;

/*Infinite loop to test Watchdog Timer Time out with interrupt.

In the case in which the Watchdog Reset cannot be disabled,

there will not be any interrupts. The watchdog time would

eventually run out, and a reset procedure will be activated*/

while (1)

{

watchdog_loop = 1;

while (watchdog_loop);

}

}

Advertising