WATCHDOG TIMER V1.1
Chapter 7 Appendix
MCU-AN-500013-E-11 – Page 16
7.3 Sample Code
7.3.1 Project Name: SWWDT
Software watchdog timer
main.c
#include "mb95200.h"
/*---------------------------------------------------------------------------
name: Delay();
function: delay function
-----------------------------------------------------------------------------*/
void Delay (unsigned int i)
{
while(i--)
{
asm("\tNOP");
}
}
/*---------------------------------------------------------------------------
name: InitWDT();
function: initial watchdog timer
-----------------------------------------------------------------------------*/
void InitCompTimer (void)
{
WDTC = 0x05;
// set count clock is 2
21
/F
CH
// start WDT counter
}
/*---------------------------------------------------------------------------
name: main();
function: main loop
-----------------------------------------------------------------------------*/
void main(void)
{
PDR0_P05 = 0;
// initial value
DDR0_P05 = 1;
// set P05 as output
InitWDT ();