📄 频率计初步1.asm
字号:
ledf equ 0a000h
org 0000h
ajmp main
org 0003h
ajmp intx0
org 000bh
ajmp intt0
org 0100h
main:
mov sp,#5fh
setb it0
setb px0 ;外部中断0优先
mov tmod,#01h
xiayi:mov th0,#0ech
mov tl0,#78h
SETB EA
SETB ET0
SETB EX0 ; 外中断
setb tr0
mov r7,#0c8h
wait: acall display
cjne r7,#00h,wait
mov ie,#00h ;只显示一秒到时的所测频率
clr tr0
mov r1,#30h; (30h)送到40单元
mov r0,#40h
zaici:mov b,@r1
mov @r0,b
inc r0
inc r1
cjne r1,#38h,zaici
mov r0,#30h
fanh: mov @r0,#00h ;将显示寄存器地址内容清零
inc r0
cjne r0,#38h,fanh
ajmp xiayi
display:
mov dptr,#ledf
mov r0,#40h
next: mov a,@r0
acall table
movx @dptr,a
acall delay
inc r0
inc dptr
cjne r0,#48h,next
ret
intx0: ;外中段
push psw
push acc
clr ex0 ;禁止外中断
mov r1,#30h
cmp: cjne @r1,#09h,first
mov @r1,#00h
inc r1
cjne r1,#38h,cmp
ajmp wanbi
first:inc @r1
wanbi:setb ex0
pop acc
pop psw
reti
intt0: ;定时器0中断
push psw
push acc
clr tr0
mov th0,#0ech
mov tl0,#78h
dec r7
huiqu:setb tr0
pop acc
pop psw
reti
;delay:
; mov r5,#10h
;delay0:mov r4,#40h
;delay1:djnz r4,delay1
; djnz r5,delay0
; ret
table:
inc a
movc a,@a+pc
ret
db 0c0h,0f9h,0a4h,0b0h,099h,092h,082h,0f8h,80h,090h
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -