打印
[国产单片机]

单片机数码管显示问题

[复制链接]
422|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
这是个篮球计分器的程序,但我只会编加分程序,怎么让分数在数码观赏显示出来?求教
a_bit equ 20H  ;甲队个位分数
b_bit equ 21H  ;十位分数
c_bit equ 22H ;乙队个位分数
d_bit equ 23H ;十位分数
couna equ 30H ;甲分数
counb equ 32H ;乙分数
ORG 0000H
LJMP START
ORG 0100H
MAIN:        MOV couna,#00H ;初始化分数
MOV counb,#00H
MOV P0,#0FFH;这部分开始本来想弄显示程序但不会
MOV P2,#0FFH
START:MOV A,R0
MOV DPTR,#TABLE
MOVC  A,@A+DPTR
MOV P2,#00H
LCALL DELAY10ms
INC R0
AJMP START


IJJ: JNB P1.0,JJJ;判断选择加分的队伍
JNB P1.5,PP1;一分
JNB P1.6,PP2;两分
JNB P1.7,PP3 ;三分
PP1:LCALL DELAY10ms
        JB P1.5,PPB
STOP1:JNB P1.5,STOP1
LCALL DELAY10ms
JNB P1.5,STOP1
INC couna
MOV A,couna
LJMP LOOP
PP2:LCALL DELAY10ms
        JB P1.6,PPB
STOP2:JNB P1.6,STOP2
LCALL DELAY10ms
JNB P1.6,STOP2
MOV A,couna
ADD A,#02
MOV couna,A
LJMP LOOP
PP3:LCALL DELAY10ms
JB P1.7,PPB
STOP3:JNB P1.7,STOP3
LCALL DELAY10ms
JNB P1.7,STOP3
MOV A,couna
ADD A,#03
MOV couna,A
LJMP LOOP

LOOP:MOV A,couna
MOV B,#10  ;
DIV AB
MOV a_bit,B  个位分数
MOV b_bit,A   十位分数
PPB:LJMP IJJ
JJJ:JB P1.0,IJJ   判断选择队伍
JNB P1.5,PP4
JNB P1.6,PP5
JNB P1.7,PP6
PP4:LCALL DELAY10ms
        JB P1.5,PPC
STOP4:JNB P1.5,STOP4
LCALL DELAY10ms
JNB P1.5,STOP4
INC counb
MOV A,counb
LJMP LOOP1
PP5:LCALL DELAY10ms
        JB P1.6,PPC
STOP5:JNB P1.6,STOP5
LCALL DELAY10ms
JNB P1.6,STOP5
MOV A,counb
ADD A,#02
MOV counb,A
LJMP LOOP1
PP6:LCALL DELAY10ms
JB P1.7,PPC
STOP6:JNB P1.7,STOP6
LCALL DELAY10ms
JNB P1.7,STOP6
MOV A,counb
ADD A,#03
MOV counb,A
LJMP LOOP1
LOOP1:MOV A,counb
MOV B,#10
DIV AB
MOV c_bit,B
MOV d_bit,A
PPC:LJMP JJJ

DELAY10ms:MOV R6,#80   ;延时程序
D1:MOV R7,#140
DJNZ R7,$
DJNZ R6,D1

RET
TABLE:DB 3FH
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH

-67871fa18c4d79d0.png (52.1 KB )

-67871fa18c4d79d0.png

相关帖子

沙发
ahui1105| | 2016-6-22 10:20 | 只看该作者
我们的MCU带LCD/LED驱动,原厂芯片,欢迎了解

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝