DIGITAL-LOGIC AG MSM586SEN/SEV Manual V1.5E
37
4.5.4 Watchdog
• The watchdog function is an implemented function of the ELAN520 and must be set/triggered by the
application
• The watchdog is hardware triggered and will be activated also in case of a hanging system
• The watchdog is programmable between 0.5ms and 32sec
• The RESWDOG.CCP is a programming sample of how to do implement it into the customer's applica-
tion. Any comments/explanations are integrated inside the file.
• There are no hardware modification necessary on the delivered and future boards to support watchdog
function. This will be the standard watchdog function on our MSM586Sxx.
RESWDOG
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void main()
{
unsigned char kk;
unsigned int tt = 0x10;//timeout = 4 Sec.
//TIMEOUT values:
// tt = 0 - invalid value
// tt = 0x01 - 0.5 uSec
// tt = 0x02 - 0.5 mSec
// tt = 0x04 - 1.0 Sec
// tt = 0x08 - 2.0 Sec
// tt = 0x10 - 4.0 Sec
// tt = 0x20 - 8.0 Sec
// tt = 0x40 - 16.0 Sec
// tt = 0x80 - 32.0 Sec
//pointer to address of WATCHDOG Timer Control
unsigned int far *ff = (unsigned int far*)MK_FP(0xE000,0xFCB0);//E000:FCB0
printf("Press ESC to quit\n");
//initialization sequence, enable WATCHDOG and assign the timeout (tt)
*ff = 0x3333;
*ff = 0xCCCC;
*ff = 0xC000 | tt;
//program body - user code
while(1)
{
if(kbhit())
{
if(getch() == 0x1B)return;//return to OS. In this sample,
//PC will reboot after 4 Sec.
}
printf("%02X\r",kk++);//nothing, just to do something
//..................
//"magic" sequence, for cleaning WATCHDOG counter
//the timing interval between such sequences must be
//not less than watchdog timeout(for this sample < 4 Sec)
*ff = 0xAAAA;
*ff = 0x5555;
}
}