基于AT89C51单片机的数字电压表设计和proteus仿真
我是用汇编语言在keil上编写的程序,但是在proteus仿真时却出了问题,显示电压的数码管一直在不停的闪烁。求帮助~~~LED_0EQU30HLED_1EQU31HLE...
我是用汇编语言在keil上编写的程序,但是在proteus仿真时却出了问题,显示电压的数码管一直在不停的闪烁。求帮助~~~
LED_0 EQU 30H
LED_1 EQU 31H
LED_2 EQU 32H
LED_3 EQU 33H
ADC EQU 35H
CLOCK BIT P1.4
ST BIT P1.5
EOC BIT P1.6
OE BIT P1.7
ORG 00H
SJMP START
ORG 0BH
LJMP INT_TO
ORG 30H
START : MOV LED_0,#00H
MOV LED_1,#00H
MOV LED_2,#00H
MOV DPTR,#TABLE ;??????
MOV TMOD,#02H
MOV TH0,#245
MOV TL0,#00H
MOV IE,#82H
SETB TR0
WAIT : CLR ST
SETB ST
CLR ST
JNB EOC,$
SETB OE
MOV ADC,P2
CLR OE
MOV A,ADC
MOV R7,A
MOV LED_3,#00H
MOV LED_2,#00H
MOV A,#00H
LOOP1: ADD A,#20H
DA A
JNC LOOP2
MOV R4,A
INC LED_2
MOV A,LED_2
CJNE A,#0AH,LOOP4
MOV LED_2,#00H
INC LED_3
LOOP4: MOV A,R4
LOOP2: DJNZ R7,LOOP1
ACALL BTOD1
LCALL DISP
SJMP WAIT
ORG 200H
BTOD1: MOV R6,A
ANL A,#0F0H
MOV R5,#4
LOOP3: RR A
DJNZ R5,LOOP3
MOV LED_1,A
MOV A,R6
ANL A,#0FH
MOV LED_0,A
RET
INT_TO :CPL CLOCK
RETI
DISP: MOV A,LED_0
MOVC A,@A +DPTR
CLR P1.3
MOV P0,A
LCALL DELAY
SETB P1.3
MOV A,LED_1
MOVC A,@A+DPTR
CLR P1.2
MOV P0,A
LCALL DELAY
SETB P1.2
MOV A,LED_2
MOVC A,@A+DPTR
CLR P1.1
MOV P0,A
LCALL DELAY
SETB P1.1
MOV A,LED_3
MOVC A,@A+DPTR
CLR P1.0
MOV P0,A
LCALL DELAY
SETB P1.0
RET
DELAY : MOV R6,#10
D1: MOV R7,#250
DJNZ R7,$
DJNZ R6,D1
RET
TABLE : DB 3FH,06H,5BH,4FH,66H ;12ò?êy??1ü7 ???μ
DB 6DH,7DH,07H,7FH,6FH
END 展开
LED_0 EQU 30H
LED_1 EQU 31H
LED_2 EQU 32H
LED_3 EQU 33H
ADC EQU 35H
CLOCK BIT P1.4
ST BIT P1.5
EOC BIT P1.6
OE BIT P1.7
ORG 00H
SJMP START
ORG 0BH
LJMP INT_TO
ORG 30H
START : MOV LED_0,#00H
MOV LED_1,#00H
MOV LED_2,#00H
MOV DPTR,#TABLE ;??????
MOV TMOD,#02H
MOV TH0,#245
MOV TL0,#00H
MOV IE,#82H
SETB TR0
WAIT : CLR ST
SETB ST
CLR ST
JNB EOC,$
SETB OE
MOV ADC,P2
CLR OE
MOV A,ADC
MOV R7,A
MOV LED_3,#00H
MOV LED_2,#00H
MOV A,#00H
LOOP1: ADD A,#20H
DA A
JNC LOOP2
MOV R4,A
INC LED_2
MOV A,LED_2
CJNE A,#0AH,LOOP4
MOV LED_2,#00H
INC LED_3
LOOP4: MOV A,R4
LOOP2: DJNZ R7,LOOP1
ACALL BTOD1
LCALL DISP
SJMP WAIT
ORG 200H
BTOD1: MOV R6,A
ANL A,#0F0H
MOV R5,#4
LOOP3: RR A
DJNZ R5,LOOP3
MOV LED_1,A
MOV A,R6
ANL A,#0FH
MOV LED_0,A
RET
INT_TO :CPL CLOCK
RETI
DISP: MOV A,LED_0
MOVC A,@A +DPTR
CLR P1.3
MOV P0,A
LCALL DELAY
SETB P1.3
MOV A,LED_1
MOVC A,@A+DPTR
CLR P1.2
MOV P0,A
LCALL DELAY
SETB P1.2
MOV A,LED_2
MOVC A,@A+DPTR
CLR P1.1
MOV P0,A
LCALL DELAY
SETB P1.1
MOV A,LED_3
MOVC A,@A+DPTR
CLR P1.0
MOV P0,A
LCALL DELAY
SETB P1.0
RET
DELAY : MOV R6,#10
D1: MOV R7,#250
DJNZ R7,$
DJNZ R6,D1
RET
TABLE : DB 3FH,06H,5BH,4FH,66H ;12ò?êy??1ü7 ???μ
DB 6DH,7DH,07H,7FH,6FH
END 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询