Appendix e, Programming watchdog timer – Lanner LVC-5000(N4) User Manual
Page 37
37
Programming Watchdog Timer
Embedded and Industrial Computing
Appendix E
Appendix E:
Programming System
Watchdog Timer of the
LVC-5000
A watchdog timer is a piece of hardware that can be
used to automatically detect system anomalies and reset
the processor in case there are any problems. Generally
speaking, a watchdog timer is based on a counter that
counts down from an initial value to zero. The software
selects the counter’s initial value and periodically restarts
it. Should the counter reach zero before the software
restarts it, the software is presumed to be malfunctioning
and the processor’s reset signal is asserted. Thus, the
processor will be restarted as if a human operator had
cycled the power.
For sample watchdog code, see watchdog folder under
LVC-5000 Utility on the Driver and Manual CD
Executing through the Command Line:
Execute the WD.EXE file under DOS (WD.EXE and CWSDPMI.
EXE should be placed on same directory), then enter the
values from 0~255. The system will reboot automatically
according to the time-out you set.
/////////////////////////////////////////////////////////
You can write your own program by modifying the source
code F81865_Test.cpp.. The index address is 2EH.
/////////////////////////////////////////////////////////////////////
////
// F81865_Test.cpp : F81865_test.exe utility for F81865.lib
APIs demonstration.
//
// History:
//
7/15/2011
Brand
new
F81865_test
program.
#include
#include “Windows.h”
#include “stdio.h”
#include “F81865.h”
#define PARAMETER_HELP
“\n”\
“The F81865 GPIO utility of Lanner\n”\
“-------------------------------------\n”\
“Usage:\n”\
“ F81865_test DIO_IN port_
number\n”\
“ F81865_test DIO_OUT port_number
value\n”\
“ F81865_test PIO port_number
value\n”\
“ F81865_test RunLED port_number
value\n”\
“ F81865_test AlarmLED port_number
value\n”\
“ F81865_test GPS_LED port_number
value\n”\
“ F81865_test WirelessLED port_number
value\n”\
“ F81865_test WatchDog seconds\n”\
“ F81865_test CaseOpen\n”\
“ F81865_test CaseOpen_Clear\n”\
“ F81865_test Sleep
milliseconds\n”\
“\n”\
“Argement:\n”\
“ DIO_IN Read state from DIO
In.\n”\
“ DIO_OUT Set DIO Out state.\n”\
“ PIO Set PIO LED state.\n”\
“ RunLED Set RUN LED state.\n”\
“ AlarmLED Set Alarm LED state.\n”\
“ GPS_LED Set GPS LED state.\n”\
“ WirelessLED Set Wireless LED state.\n”\