AR-B1380/AR-1380A User’ s Guide
Page 44
(2) Enable the Watchdog Timer
To enable the watchdog timer, you have to output a byte of timer factor to the watchdog register whose
address is 214H or Base Port. The following is a BASICA program which demonstrates how to enable the
watchdog timer and set the time-out period at 24 seconds.
1000
REM Points to command register
1010
WD_REG% = 214H
1020
REM Timer factor = 84H (or 0C4H)
1030
TIMER_FACTOR% = %H84
1040
REM Output factor to watchdog register
1050
OUT WD_REG%, TIMER_FACTOR%
.,etc.
(3) Trigger the Watchdog Timer
After you enable the watchdog timer, your program must write the same factor as enabling to the watchdog
register at least once every time-out period to its previous setting. You can change the time-out period by
writing another timer factor to the watchdog register at any time, and you must trigger the watchdog before
the new time-out period in the next trigger. Below is a BASICA program which demonstrates how to trigger
the watchdog timer:
2000
REM Points to command register
2010
WD_REG% = 214H
2020
REM Timer factor = 84H (or 0C4H)
2030
TIMER_FACTOR% = &H84
2040
REM Output factor to watchdog register
2050
OUT WD_REG%, TIMER_FACTOR%
.,etc.
(4) Disable Watchdog Timer
To disable the watchdog timer, simply write a 00H to the watchdog register.
3000
REM Points to command register
3010
WD_REG% = BASE_PORT%
3020
REM Timer factor = 0
3030
TIMER_FACTOR% = 0
3040
REM Output factor to watchdog register
3050
OUT WD_REG%, TIMER_FACTOR%
., etc.
5.4.2 Built-in Watchdog Timer
Once you have enabled the watchdog timer, your program must trigger the watchdog timer every time
before it times-out. After you trigger the watchdog timer, it will be set to zero and start to count again. If
your program fails to trigger the watchdog timer before time-out, it will generate a reset pulse to reset the
system or trigger an IRQ or NMI signal to tell your program that the watchdog has timed out. The time-out
period can be programmed to be 30.5
£ g
seconds to 512 seconds with 30.5
£ g
seconds per step.
The following are the watchdog timer registers:
•
Index 37H
: WD Enable Register
•
Index 38H
: WD Report Register
•
Index 39H, 3AH, 3BH : WD 24-bit Timer Counter
•
Index 3CH
: WD Status Register
(1) INDEX 37H: WD Enable Register
This register is used to enable or disable the watchdog timer.
Bit 7
Reserved. Please do not set this bit. In the old version M6117C
data sheet, this bit is counter read mode.
Bit 6=0 Disable the watchdog timer
Bit 6=1 Enable the watchdog timer
Bit 5-0 Other function. Please do not modify these bits.
Summary of Contents for AR-B1380
Page 2: ......