您的当前位置:首页正文

8位数码管循环显示学号

2023-01-10 来源:榕意旅游网


Proteus图:

Keil 51程序:

ORG 0000H

AJMP START

ORG 0100H

START:

MOV 30H, #2 //学号为 **********;

MOV 31H, #0

MOV 32H, #1

MOV 33H, #3

MOV 34H, #0

MOV 35H, #0

MOV 36H, #0

MOV 37H, #0

MOV 38H, #0

MOV 39H, #0

MOV 3AH, #10

MOV 3BH, #10

MOV 3CH, #10

LOOP:

MOV R5, #15

L1: ACALL XIANSHI

DJNZ R5, L1

ACALL DELL

AJMP LOOP

XIANSHI: MOV R0, #30H

MOV R1, #0FEH

MOV R2, #8

MOV DPTR, #LEDCODE

;显示函数

WWW:

MOV A, @R0

MOVC A, @A+DPTR

MOV P2, #0FFH

MOV P0, A

MOV P2, R1

ACALL DELAY

INC R0

MOV A, R1

RL A

MOV R1, A

DJNZ R2, WWW

RET

DELAY: ;延时函数

MOV R6, #13

WAR: MOV R7, #200

DJNZ R7, $

DJNZ R6, WAR

RET

DELL:

MOV 3DH, 30H

MOV 30H, 31H

MOV 31H, 32H

MOV 32H, 33H

MOV 33H, 34H

MOV 34H, 35H

MOV 35H, 36H

MOV 36H, 37H

MOV 37H, 38H

MOV 38H, 39H

MOV 39H, 3AH

MOV 3AH, 3BH

MOV 3BH, 3CH

MOV 3CH, 3DH

RET

LEDCODE: ;共阴数码管码表0 – 9 DB 3FH, 06H, 5bH, 4fH, 66H, 6dH, 7dH, 07H

DB 7fH, 6fH, 00H

END

和 不显示

因篇幅问题不能全部显示,请点此查看更多更全内容