📄 123.asm
字号:
led_0 equ 30h
led_1 equ 31h
led_2 equ 32h
adc equ 35h
clock bit p2.4
st bit p2.5
eoc bit p2.6
oe bit p2.7
org 0000h
ljmp start
org 0bh
ljmp int_t0
org 0050h
int_t0: cpl clock
reti
delay: mov r6,#10
d1: mov r7,#250
djnz r7,$
djnz r6,d1
ret
disp: mov dptr,#table
mov a,led_0
movc a,@a+dptr
clr p2.3
mov p0,a
lcall delay
setb p2.3
mov a,led_1
movc a,@a+dptr
clr p2.2
mov p0,a
lcall delay
setb p2.2
mov a,led_2
movc a,@a+dptr
clr p2.1
mov p0,a
lcall delay
setb p2.1
ret
s: mov sbuf,a
jnb ti,$
clr ti
ret
org 0200h
start: mov sp,#60h
mov led_0,#00h
mov led_1,#00h
mov led_2,#00h
mov tmod,#22h ;T0和T1都工作在方式2
mov scon,#01010000b
mov pcon,#00h
mov th0,#245
mov tl0,#00h
mov th1,#0fdh ;波特率不倍增下9600波特初值。
mov tl1,#0fdh
mov ie,#82h ;开中断T0而不开T1
setb tr0
setb tr1 ;启动T0和T1
wait: clr st
setb st
clr st
jnb eoc,$
setb oe
mov adc,p1
clr oe
mov a,adc
lcall s
mov b,#100
div ab
mov led_2,a
mov a,b
mov b,#10
div ab
mov led_1,a
mov led_0,b
lcall disp
ljmp wait
table: db 3fh,06h,5bh,4fh,66h
db 6dh,7dh,07h,7fh,6fh
org 0300h
attable:
db 41h,54h,0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 41h,54h,2bh,43h,4dh,47h,46h,3dh,31h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 41h,54h,2bh,43h,53h,43h,53h,3dh,22h,55h,43h,53h,32h,22h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 41h,54h,2bh,43h,53h,4dh,50h,3dh,31h,37h,2ch,31h,36h,37h,2ch,30h,2ch,30h,38h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 41h,54h,2bh,43h,4dh,47h,53h,3dh,22h,31h,33h,35h,37h,30h,33h,33h,34h,36h,34h,38h,22h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 3eh,34h,46h,36h,30h,35h,39h,37h,44h,35h,34h,31h,37h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
db 31h,41h
db 0dh
db 4fh,4bh
db 45h,52h,52h,4fh,52h
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -