📄 计数器.asm
字号:
org 0000h
ajmp main
org 000bh
reti
org 001bh
ajmp int_1
main: mov a,#0bbh
mov r4,#04h
acall led
start: mov sp,#60h
mov tmod,#1dh
mov tl0,#00h
mov th0,#00h
mov tl1,#0b0h ;晶振为12M,若晶振为11.0592M时,时间常数为4C00H,若晶振为6M时,时间常数为9E58H
mov th1,#3ch
mov r0,#14h
setb tr0
setb et0
setb tr1
setb et1
setb ea
here: sjmp here
int_1: push acc
push psw
clr tr1
clr tr0
mov r1,tl0
mov r2,th0
mov tl0,#00h
mov th0,#00h
mov tl1,#0b0h
mov th1,#3ch
setb tr1
setb tr0
djnz r0,e_end
mov r0,#14h
mov a,r1
acall show
mov a,r2
acall show
e_end: pop psw
pop acc
reti
show: mov b,#10h
div ab
mov r5,a
mov r3,b
mov dptr,#tab
mov a,r3
movc a,@a+dptr
mov r4,#01h
acall led
mov a,r5
mov dptr,#tab
movc a,@a+dptr
mov r4,#01h
acall led
ret
led: mov scon, #00h
mov sbuf, a
jnb ti, $
clr ti
djnz r4,led
ret
tab: db 0bbh,09h,0eah,6bh,59h,73h,0f3h,0bh
db 0fbh,07bh,0dbh,0f1h,0b2h,0e9h,0f2h,0d2h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -