(单片机求助)用数码管显示自己的学号(例如2830850407),要求用汇编语言编写
哇...cool,但是有没有稍微简单点的呢,我有点看不懂,初学者我是.. 展开
ORG 00H
AJMP MAIN
ORG 30H
MAIN: MOV 20H,#2 ;把你的学号的10位送到相应单元
MOV 21H,#8
MOV 22H,#3
MOV 23H,#0
MOV 24H,#8
MOV 25H,#5
MOV 26H,#0
MOV 27H,#4
MOV 28H,#0
MOV 29H,#7
LCALL DISP ;显示子程序
AJMP MAIN
DISP: MOV A,20H ;送最高位到A
ACALL SEG7 ;取码指针子程序
MOV P0,A ;段码送P0口
CLR P2.0 ;位选
ACALL DLY ;延时1MS,即显示1MS
SETB P2.0 ;关显示。 动态显示的方法就是 :取优码,送段码,位选,延时1MS,关显示.
MOV A,21H ;下一位
ACALL SEG7
MOV P0,A
CLR P2.1
ACALL DLY
SETB P2.1
MOV A,22H
ACALL SEG7
MOV P0,A
CLR P2.2
ACALL DLY
SETB P2.2
MOV A,23H
ACALL SEG7
MOV P0,A
CLR P2.3
ACALL DLY
SETB P2.3
MOV A,24H
ACALL SEG7
MOV P0,A
CLR P2.4
ACALL DLY
SETB P2.4
MOV A,25H
ACALL SEG7
MOV P0,A
CLR P2.5
ACALL DLY
SETB P2.5
MOV A,26H
ACALL SEG7
MOV P0,A
CLR P2.6
ACALL DLY
SETB P2.6
MOV A,27H
ACALL SEG7
MOV P0,A
CLR P2.7
ACALL DLY
SETB P2.7
MOV A,28H
ACALL SEG7
MOV P0,A
CLR P3.0
ACALL DLY
SETB P3.0
MOV A,29H
ACALL SEG7
MOV P0,A
CLR P3.1
ACALL DLY
SETB P3.1
RET
DLY: MOV R7,#10 ;延时1MS子程序。12M晶振,粗略算法:2X R7 X R6
D1: MOV R6,#50
DJNZ R6,$
DJNZ R7,D1
RET
SEG7: INC A
MOVC A,@A+PC
RET
DB 03FH;0 共阴管段码
DB 006H;1
DB 05BH;2
DB 04FH;3
DB 066H;4
DB 06DH;5
DB 07DH;6
DB 007H;7
DB 07FH;8
DB 06FH;9
END
2022-05-15 广告