![Atmel STK511 Скачать руководство пользователя страница 31](http://html.mh-extra.com/html/atmel/stk511/stk511_user-manual_3003507031.webp)
STK511 Transmitter Board
5-8
STK511 User Guide
4842B–AVR–10/09
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; subroutine: ISRWatchDog
; calls: SensorADC
; called by: <uC watchdog interrupt firmware>
; function: calls A-D Converter routine (which reads signal from light
; sensor) at the appropriate interval-rate, based on which
; button was pressed
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ISRWatchDog:
PUSH
R16
; TP - All functions must have push and pop
statements!
IN
R31,SREG
; TP - Save status register
CLI
; TP - Disable interrupts
RCALL
SensorADC
; TP - Read the sensor data
RCALL
Xmt
; TP - Send the data
DEC
WDTcounter
; TP - Decrement number of WDT interrupts
LDI
r16, 0x00
; TP - Reset I/O states
OUT
PORTB, r16
; set ports to
low
OUT
DDRB, r16
; set ports to inputs
ISRWatchDogEnd:
LDI
R16,0x20
; TP - Clear interrupt flags
OUT
GIFR,R16
LDI
R16,0xF7
OUT
MCUSR,R16
WDR
; TP - Clear watchdog timer
SEI
; TP - Enable interrupts
OUT
SREG,R31
; TP - Restore status register
POP
R16
; TP - All functions must have push and pop
statements!
RETI