User`s manual

OP7100 Hardware
27
main(){
...
}
...
char dummy[24];
...
#define INT1
_
BIT 0 ; bit 0
#INT
_
VEC INT1
_
VEC power_fail_isr
#asm
power_fail_isr::
ld sp,dummy+24 ; force stack pointer
; to top of dummy vector
; to prevent overwriting
; code or data
do whatever service, within allowable execution time
loop:
call hitwd ; make sure no watchdog reset
; while low voltage
ld bc,INT1 ; load the read INT1 register
; to bc
in a,(c) ; read the read INT1 register
; for /PFO
bit INT1_BIT, a ; check for status of /PFO
jr nz,loop ; wait until the brownout
; clears
timeout: ; then...a tight loop to
; force a watchdog timeout,
jp timeout ; resetting the Z180
#endasm
Of course, if the DC input voltage continues to decrease, then the OP7100
will just power down.
Call the Dynamic C function hitwd during the power-failure service
routine to make sure that the watchdog timer does not time out and thereby
reset the processor. The controller can continue to run at low voltages, and
so it might not be able to detect the low-voltage condition after the
watchdog timer resets the processor.
Watchdog Timer
To increase reliability, the ADM691’s watchdog timer forces a system reset if
a program does not notify the supervisor nominally at least every second. The
assumption is that if the program fails to “hit” the watchdog, the program
must be stuck in a loop or halted. The Dynamic C function for hitting the