51单片机LED管显示子程序实例
扫描二维码
随时随地手机看文章
;DISP显示子程序
PORT_AEQU0CF01H
PORT_BEQU0CF02H
PORT_CEQU0CF03H
;功能:将显示缓冲区39-3FH内容显示一遍
;3FH对应八个LED管
;3E-39H自左到右对应数码
;占用:PSW,ACC,DPTR,R0,R3,R6,R7内
;
ORG0DE00H
DISP1:MOVR0,#3FH
DISP_0:MOVR3,#01000000B;位选字
MOVA,@R0;取显示数据
SJMPDISP_2
DISP_1:MOVDPTR,#LED_TB
MOVA,@R0
MOVCA,@A+DPTR
DISP_2:CPLA;字型求反
MOVDPTR,#PORT_B
MOVX@DPTR,A;字型送8155B口
MOVA,R3
DECDPL
MOVX@DPTR,A;位选字送8155A口
LCALLD1MS;延时1MS
CLRA
MOVDPTR,#PORT_A
MOVX@DPTR,A;关显示
DECR0
MOVR3,A
RRA
MOVA,R3
JNBACC.7,DISP_1
MOVA,R0
ADDA,#7
MOVR0,A
RET
D1MS:MOVR6,#0
DJNZR6,$
RET
;
;显示字型表
ORG0130H
LED_TB:DB3FH,06H,5BH,4FH;0123
DB66H,6DH,7DH,07H;4567
DB7FH,6FH,77H,7CH;89AB
DB39H,5EH,79H,71H;CDEF
DB00H,73H,58H,4CH;_P [ ]
DB76H,5EH;HD