AT90S2313-WatchdogTimer
This application program shows the working of a watch dog timer in AT90S2313. In
this program normally the output will be 0F & F0 during TIMER0 overflow,
whenever the time reaches 49ms the program restarts.
The program uses one AT90S2313, 2 drivers & two 7-segment displays.
The program is as shown:
_SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
.text
.global main
.type main, @function
;--------------WATCHDOG_TIMER USING AVR AT90S2313----------
;--------------MAIN ROUTINE --------------------------------
main:
ldi r24,0xff ; Setting up the PORTB in Output Mode
out 0x17,r24 ; Change the R24 value for more delay in Watchdog Reset
ldi r24,0x0A ; Setting up the watch dog timer at 50ms
out 0x21,r24
ldi r16,0x02 ; Enabling the Timer0 Overflow Interrupt
out 0x39,r16
ldi r24,0x00 ;Initializing the Timer0 To 0
out 0x32,r24
ldi r24 ,0x01 ;Setting the Timer0 Control Register = Clk
out 0x33,r24
sei
ldi r27, 0x0f ; Outputting the 00001111 through PORTB
out 0x18, r27
L2:
rjmp L2
;----------------------------------------------------
; TIMER 0 OVERFLOW INTERRUPT ROUTINE
; INTERRUPT VECTOR 6
;----------------------------------------------------
.size main, .-main
.global __vector_6
.type __vector_6, @function
__vector_6:
swap r27
out 0x18,r27 ; Swapping the value at PORTB
ldi r24,0x00 ; Clearing the TOV0 at TIFR Register
out 0x38,r24
rjmp L2