at89c51芯片的p0管脚作为2个四位bcd码的输出到cd4511bcn中去,然后通过cd4511bcn输出到2个8段显示器中,但是总是没有任何反应,请各位帮忙看看:以下是代码:
-+
- COUNT EQU 30H
- S1 BIT P1.0
- S2 BIT P1.1
- ORG 0000H
- MOV P0,#00H
- WAIT1: JB S1,WAIT1
- START: MOV COUNT,#00H ;30H清零
- NEXT: MOV A,COUNT ;送A
- MOV B,#10 ;10送B
- DIV AB ;A除以B,A放商,B放余数
- MOV DPTR,#TABLE ;取表
- MOVC A,@A+DPTR ;取商数据送A
- SWAP A
- MOV R0,A
- MOV A,B
- MOVC A,@A+DPTR
- ADD A,R0
- MOV P0,A ;低位段码数据中P0口显示
- CPL A
- INC COUNT
- WAIT: JNB S2,WAIT
- LCALL K1
- MOV A,COUNT ;30H内容送A
- CJNE A,#100,NEXT ;A是否到100(显示99后)
- LJMP START ;到了返回重新开始
- K1: MOV R5,#5
- D1: MOV R6,#0FFH
- D2: MOV R7,#80
- D3: NOP
- DJNZ R7,D3
- DJNZ R6,D2
- DJNZ R5,D1
- RET
- TABLE: DB 0,1,2,3,4,5,6,7,8,9
- END