|
主题 : : 各位高手,帮我看看我的程序哪错 [待解决] |
回复[ 1次 ]
点击[ 531次 ] | |
荣誉值:0
信誉值:0
注册日期:2009-05-07 21:00 |
org 0000h
LJMP START
ORG 0003H
LJMP JIAY
ORG 000BH
LJMP DJSH
ORG 0013H
LJMP JIASHI
ORG 0023H
RETI
ORG 0025H
start:
MOV A ,#0FFH
MOV P1,A
MOV P2,A
MOV P3,A
MOV P0,A
MOV A ,#00H
MOV 30H,A
MOV 31H,A
SETB IT0
SETB IT1
MAIN:
LCALL DISPLAY
JNB P1.2 , JIAY
JNB P1.3 , JIASHI
JNB P1.4 , DJSH
AJMP MAIN
JIAY:
LCALL DL10MS
JB P1.2 , MAIN
CLR EA
mov A ,#01H
ADD A ,30H
mov 30H, A
CJNE A,#0ah , MAIN
mov 30H , #00h
mov A, 01H
ADD A, 31H
mov 31H ,A
SETB EA
LJMP MAIN
JIASHI:
LCALL DL10MS
JB P1.3 , MAIN
CLR EA
MOV A , 01H
ADD A , 31H
mov 31H ,A
CJNE A,0Ah, MAIN
SETB EA
LJMP START
DJSH:
LCALL DISPLAY
LCALL DL10MS
JB P1.4 , MAIN
MOV TMOD, #01H
MOV 20H,#0AH
SETB ET0
SETB EA
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR0
HERE: CALL DISPLAY
SJMP HERE
TIME0: PUSH PSW
PUSH A
MOV TH0,#3CH
MOV TL0,#0B0H
DJNZ 20H,RETURN
MOV 20H,#0AH
MOV A,30H
CJNE A,#00H,TIME01
MOV A,31H
CJNE A,#00H,TIME02
CLR P1.0
TIME01: DEC 30H
LJMP TIME0OUT
TIME02: DEC 31H
MOV 30H ,#09H
LJMP TIME0OUT
TIME0OUT: RETI
RETURN: POP A
POP PSW
RETI
DISPLAY:
MOV R0,#30H
MOV DPTR,#TAB
MOV A ,@R0
MOVC A,@A+DPTR
MOV P0,A
CLR P2.1
LCALL DL1ms
SETB P2.1
MOV R0,#31H
MOV DPTR ,#TAB
MOV A,@R0
MOVC A,@A+DPTR
MOV P0,A
CLR P2.0
LCALL DL1ms
SETB P2.0
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H,0BFH
DL1ms: MOV R7,#02H
DL1: MOV R6,#0FFH
DL6: DJNZ R6,DL6
DJNZ R7,DL1
RET
DL10MS:MOV R5,#0AH
DL10: MOV R4,#0FFH
DL4: DJNZ R4,DL4
DJNZ R5,DL10
RET
END
编译通过了,但没有实现功能,帮我看看吧,各位高手。我想实现,其中P1.2用来设定秒个位数值,其中P1.3用来设定秒十位数值,P1.4用来检测设置时间完毕并开始倒计时。 | | |