AT90S2313-Multiple Interrupts
This project shows the application of interrupts on AT90S2313 Microcontroller.
This database uses one AT90S2313 Microcontroller, 2 interrupts, 2 displays for displaying the sequence & 2 display drivers for driving display units.
Here the application of one interrupt will result in a count sequence from 00 - 0F while the application of the other interrupt will cause the chip to count from 0F - 00.
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
main:
/* prologue: frame size=0 */
/*ldi r28,lo8(__stack - 0)
ldi r29,hi8(__stack - 0)
out __SP_H__,r29
out __SP_L__,r28
/* prologue end (size=4) */
ldi r25,0x30 ; here R25 is used just as a counter
ldi r20, 0xFF
out 0x17,r20 ;loading DDRB register with FF for setting in output mode
ldi r17, 0xc0
ldi r22, 0x80
ldi r26, 0x30
com r20
out 0x3B, r17 ;setting of GIMSK register
out 0x3f, r22 ;setting of SREG register
out 0x35, r26 ;setting of MCUCR register
out 0x18, r20
loop1:
rjmp loop1
.size main, .-main
.global __vector_1
.type __vector_1, @function
__vector_1:
ldi r30,0xdf
out __SP_L__,r30
clr r16
ldi r16,0x10
disp: out 0x18 , r16
;--------delay -------------
l2: subi r25,0x01 ;subtracting by 1
cpi r25,0x00 ;checking whether R25 equals zero
brne l2 ;if not equal jumps to label 'l2'
;--------delay ends-------------
subi r16,0x01 ;subtracting by 1
cpi r16,0x00 ;checking whether R16 equals zero
brne disp ;if not equal jumps to label 'disp'
reti
.size __vector_1, .-__vector_1
.global __vector_2
.type __vector_2, @function
__vector_2:
ldi r25,0x20
ldi r30,0xdf
out __SP_L__,r30
clr r28
dp: out 0x18 , r28
;--------delay -------------
l5: subi r25,0x01 ;subtracting by 1
cpi r25,0x00 ;checking whether R25 equals zero
brne l5 ;if not equal jumps to label 'l5'
;--------delay ends-------------
adiw r28,0x01 ;subtracting by 1
cpi r28,0x10 ;checking whether R28 equals '0x10'
brne dp ;if not equal jumps to label 'dp'
reti
.size __vector_2, .-__vector_2