Untitled
Guest 19 20th Nov, 2024
; POD ZADNYM POZOREM NIE WPISYWAC ORG 100 LUB ORG 200
; piny przerwan to 3.2 i 3.3
; reset to org0
org 0
sjmp st
org 0x3 ;obsluga przerwania int0
acall _int0
reti
org 0x13 ;obsluga przerwania int1
acall _int1
reti
st: clr ea
mov counter, #1h
setb tcon.2
setb tcon.0
setb et1
setb et0
setb ie.0
setb ie.2
setb ea
mov a,#03h
mov p1, a
mov p1, #02h
mov p0, #0C0h
init: mov R3, #00Ah
main: mov DPTR, #TAB
loop:
sjmp loop
reset_counter:
mov counter, 1
ret
_int1:
clr a
mov a, counter
movc a, @a+DPTR
mov p1, #01h
mov p0, a
clr c
inc counter
mov a, counter
subb a, 10
jz reset_counter
ret
_int0:
clr a
mov a, counter
movc a, @a+DPTR
mov p1, #01h
mov p0, a
clr c
dec counter
mov a, counter
orl a, #0h
jz reset_counter
ret
org 200
TAB: DB 0C0h, 0F9h, 0A4h, 0B0h, 99h, 92h, 82h, 0F8h, 80h, 90h
counter equ 0x40
END
To share this paste please copy this url and send to your friends
RAW Paste Data