hathaphan01
member
คะแนน 0
ออฟไลน์
กระทู้: 2
|
|
« เมื่อ: ตุลาคม 08, 2012, 10:32:40 pm » |
|
ORG 0000H
SECOND EQU 40H MINUTE EQU 41H HOUR EQU 42H
LJMP SETTIME
ORG 000BH MOV 01H,A DJNZ R7,OUT MOV R7,#20 INC SECOND MOV A,SECOND CJNE A,#3CH,OUT MOV SECOND,#00H INC MINUTE MOV A,MINUTE CJNE A,#3CH,OUT MOV MINUTE,#00H INC HOUR MOV A,HOUR CJNE A,#0CH,OUT MOV HOUR,#00H OUT: MOV A,01H RETI
ORG 0043H
SETTIME: MOV SECOND,#0 MOV MINUTE,#0 MOV HOUR,#9
COUNT: MOV R7,#20 MOV TMOD,#01H MOV TH0,#2CH MOV TL0,#0B0H SETB TR0 MOV IE,#82H
START: MOV P0,#0FEH MOV P1,#00H MOV P3,#00H MOV P2,#0FFH
CHECK_SW: MOV A,P2 CJNE A,#0FFH,CHECK_SW
S0: MOV A,SECOND CJNE A,#00H,S1 MOV P1,#0FFH MOV P3,#0FFH LCALL DELAY_DSP MOV P1,#00H MOV P3,#00H JMP M0 S1: MOV A,SECOND CJNE A,#01H,S2 MOV R2,#1 JMP DSP_S S2: MOV A,SECOND CJNE A,#02H,S3 MOV R2,#2 JMP DSP_S S3: MOV A,SECOND CJNE A,#03H,S4 MOV R2,#3 JMP DSP_S S4: MOV A,SECOND CJNE A,#04H,S5 MOV R2,#5 JMP DSP_S S5: MOV A,SECOND CJNE A,#05H,S6 MOV R2,#6 JMP DSP_S S6: MOV A,SECOND CJNE A,#06H,S7 MOV R2,#7 JMP DSP_S S7: MOV A,SECOND CJNE A,#07H,S8 MOV R2,#8 JMP DSP_S S8: MOV A,SECOND CJNE A,#08H,S9 MOV R2,#9 JMP DSP_S S9: MOV A,SECOND CJNE A,#09H,S10 MOV R2,#10 JMP DSP_S S10: MOV A,SECOND CJNE A,#0AH,S11 MOV R2,#11 JMP DSP_S S11: MOV A,SECOND CJNE A,#0BH,S12 MOV R2,#12 JMP DSP_S S12: MOV A,SECOND CJNE A,#0CH,S13 MOV R2,#13 JMP DSP_S S13: MOV A,SECOND CJNE A,#0DH,S14 MOV R2,#14 JMP DSP_S S14: MOV A,SECOND CJNE A,#0EH,S15 MOV R2,#15 JMP DSP_S S15: MOV A,SECOND CJNE A,#0FH,S16 MOV R2,#16 JMP DSP_S S16: MOV A,SECOND CJNE A,#10H,S17 MOV R2,#17 JMP DSP_S S17: MOV A,SECOND CJNE A,#11H,S18 MOV R2,#19 JMP DSP_S S18: MOV A,SECOND CJNE A,#12H,S19 MOV R2,#21 JMP DSP_S S19: MOV A,SECOND CJNE A,#13H,S20 MOV R2,#22 JMP DSP_S S20: MOV A,SECOND CJNE A,#14H,S21 MOV R2,#23 JMP DSP_S S21: MOV A,SECOND CJNE A,#15H,S22 MOV R2,#24 JMP DSP_S S22: MOV A,SECOND CJNE A,#16H,S23 MOV R2,#25 JMP DSP_S S23: MOV A,SECOND CJNE A,#17H,S24 MOV R2,#26 JMP DSP_S S24: MOV A,SECOND CJNE A,#18H,S25 MOV R2,#27 JMP DSP_S S25: MOV A,SECOND CJNE A,#19H,S26 MOV R2,#28 JMP DSP_S S26: MOV A,SECOND CJNE A,#1AH,S27 MOV R2,#29 JMP DSP_S S27: MOV A,SECOND CJNE A,#1BH,S28 MOV R2,#30 JMP DSP_S S28: MOV A,SECOND CJNE A,#1CH,S29 MOV R2,#31 JMP DSP_S S29: MOV A,SECOND CJNE A,#1DH,S30 MOV R2,#32 JMP DSP_S S30: MOV A,SECOND CJNE A,#1EH,S31 MOV R2,#33 JMP DSP_S S31: MOV A,SECOND CJNE A,#1FH,S32 MOV R2,#34 JMP DSP_S S32: MOV A,SECOND CJNE A,#20H,S33 MOV R2,#35 JMP DSP_S S33: MOV A,SECOND CJNE A,#21H,S34 MOV R2,#36 JMP DSP_S S34: MOV A,SECOND CJNE A,#22H,S35 MOV R2,#37 JMP DSP_S S35: MOV A,SECOND CJNE A,#23H,S36 MOV R2,#38 JMP DSP_S S36: MOV A,SECOND CJNE A,#24H,S37 MOV R2,#39 JMP DSP_S S37: MOV A,SECOND CJNE A,#25H,S38 MOV R2,#40 JMP DSP_S S38: MOV A,SECOND CJNE A,#26H,S39 MOV R2,#42 JMP DSP_S S39: MOV A,SECOND CJNE A,#27H,S40 MOV R2,#43 JMP DSP_S S40: MOV A,SECOND CJNE A,#28H,S41 MOV R2,#45 JMP DSP_S S41: MOV A,SECOND CJNE A,#29H,S42 MOV R2,#46 JMP DSP_S S42: MOV A,SECOND CJNE A,#2AH,S43 MOV R2,#47 JMP DSP_S S43: MOV A,SECOND CJNE A,#2BH,S44 MOV R2,#48 JMP DSP_S S44: MOV A,SECOND CJNE A,#2CH,S45 MOV R2,#49 JMP DSP_S S45: MOV A,SECOND CJNE A,#2DH,S46 MOV R2,#51 JMP DSP_S S46: MOV A,SECOND CJNE A,#2EH,S47 MOV R2,#52 JMP DSP_S S47: MOV A,SECOND CJNE A,#2FH,S48 MOV R2,#53 JMP DSP_S S48: MOV A,SECOND CJNE A,#30H,S49 MOV R2,#54 JMP DSP_S S49: MOV A,SECOND CJNE A,#31H,S50 MOV R2,#55 JMP DSP_S S50: MOV A,SECOND CJNE A,#32H,S51 MOV R2,#56 JMP DSP_S S51: MOV A,SECOND CJNE A,#33H,S52 MOV R2,#57 JMP DSP_S S52: MOV A,SECOND CJNE A,#34H,S53 MOV R2,#59 JMP DSP_S S53: MOV A,SECOND CJNE A,#35H,S54 MOV R2,#60 JMP DSP_S S54: MOV A,SECOND CJNE A,#36H,S55 MOV R2,#61 JMP DSP_S S55: MOV A,SECOND CJNE A,#37H,S56 MOV R2,#62 JMP DSP_S S56: MOV A,SECOND CJNE A,#38H,S57 MOV R2,#63 JMP DSP_S S57: MOV A,SECOND CJNE A,#39H,S58 MOV R2,#64 JMP DSP_S S58: MOV A,SECOND CJNE A,#3AH,S59 MOV R2,#65 JMP DSP_S S59: MOV A,SECOND MOV R2,#66
DSP_S: LCALL DELAY MOV P1,#0FFH MOV P3,#7FH LCALL DELAY_DSP MOV P1,#00H MOV P3,#00H JMP M0
M0: MOV A,P2 CJNE A,#0FFH,M0 MOV A,MINUTE CJNE A,#00H,M1 MOV P1,#0FFH MOV P3,#0FFH LCALL DELAY_DSP MOV P1,#00H MOV P3,#00H JMP H0 M1: MOV A,MINUTE CJNE A,#01H,M2 MOV R2,#1 JMP DSP_M M2: MOV A,MINUTE CJNE A,#02H,M3 MOV R2,#2 JMP DSP_M M3: MOV A,MINUTE CJNE A,#03H,M4 MOV R2,#3 JMP DSP_M M4: MOV A,MINUTE CJNE A,#04H,M5 MOV R2,#5 JMP DSP_M M5: MOV A,MINUTE CJNE A,#06H,M6 MOV R2,#6 JMP DSP_M M6: MOV A,MINUTE CJNE A,#06H,M7 MOV R2,#7 JMP DSP_M M7: MOV A,MINUTE CJNE A,#07H,M8 MOV R2,#8 JMP DSP_M M8: MOV A,MINUTE CJNE A,#08H,M9 MOV R2,#9 JMP DSP_M M9: MOV A,MINUTE CJNE A,#09H,M10 MOV R2,#10 JMP DSP_M M10: MOV A,MINUTE CJNE A,#0AH,M11 MOV R2,#11 JMP DSP_M M11: MOV A,MINUTE CJNE A,#0BH,M12 MOV R2,#12 JMP DSP_M M12: MOV A,MINUTE CJNE A,#0CH,M13 MOV R2,#13 JMP DSP_M M13: MOV A,MINUTE CJNE A,#0DH,M14 MOV R2,#14 JMP DSP_M M14: MOV A,MINUTE CJNE A,#0EH,M15 MOV R2,#15 JMP DSP_M M15: MOV A,MINUTE CJNE A,#0FH,M16 MOV R2,#16 JMP DSP_M M16: MOV A,MINUTE CJNE A,#10H,M17 MOV R2,#17 JMP DSP_M M17: MOV A,MINUTE CJNE A,#11H,M18 MOV R2,#18 JMP DSP_M M18: MOV A,MINUTE CJNE A,#12H,M19 MOV R2,#19 JMP DSP_M M19: MOV A,MINUTE CJNE A,#13H,M20 MOV R2,#20 JMP DSP_M M20: MOV A,MINUTE CJNE A,#14H,M21 MOV R2,#21 JMP DSP_M M21: MOV A,MINUTE CJNE A,#15H,M22 MOV R2,#22 JMP DSP_M M22: MOV A,MINUTE CJNE A,#16H,M23 MOV R2,#23 JMP DSP_M M23: MOV A,MINUTE CJNE A,#17H,M24 MOV R2,#24 JMP DSP_M M24: MOV A,MINUTE CJNE A,#18H,M25 MOV R2,#26 JMP DSP_M M25: MOV A,MINUTE CJNE A,#19H,M26 MOV R2,#27 JMP DSP_M M26: MOV A,MINUTE CJNE A,#1AH,M27 MOV R2,#28 JMP DSP_M M27: MOV A,MINUTE CJNE A,#1BH,M28 MOV R2,#29 JMP DSP_M M28: MOV A,MINUTE CJNE A,#1CH,M29 MOV R2,#30 JMP DSP_M M29: MOV A,MINUTE CJNE A,#1DH,M30 MOV R2,#31 JMP DSP_M M30: MOV A,MINUTE CJNE A,#1EH,M31 MOV R2,#33 JMP DSP_M M31: MOV A,MINUTE CJNE A,#1FH,M32 MOV R2,#34 JMP DSP_M M32: MOV A,MINUTE CJNE A,#20H,M33 MOV R2,#35 JMP DSP_M M33: MOV A,MINUTE CJNE A,#21H,M34 MOV R2,#36 JMP DSP_M M34: MOV A,MINUTE CJNE A,#22H,M35 MOV R2,#37 JMP DSP_M M35: MOV A,MINUTE CJNE A,#23H,M36 MOV R2,#38 JMP DSP_M M36: MOV A,MINUTE CJNE A,#24H,M37 MOV R2,#39 JMP DSP_M M37: MOV A,MINUTE CJNE A,#25H,M38 MOV R2,#40 JMP DSP_M M38: MOV A,MINUTE CJNE A,#26H,M39 MOV R2,#41 JMP DSP_M M39: MOV A,MINUTE CJNE A,#27H,M40 MOV R2,#42 JMP DSP_M M40: MOV A,MINUTE CJNE A,#28H,M41 MOV R2,#44 JMP DSP_M M41: MOV A,MINUTE CJNE A,#29H,M42 MOV R2,#45 JMP DSP_M M42: MOV A,MINUTE CJNE A,#2AH,M43 MOV R2,#46 JMP DSP_M M43: MOV A,MINUTE CJNE A,#2BH,M44 MOV R2,#47 JMP DSP_M M44: MOV A,MINUTE CJNE A,#2CH,M45 MOV R2,#49 JMP DSP_M M45: MOV A,MINUTE CJNE A,#2DH,M46 MOV R2,#51 JMP DSP_M M46: MOV A,MINUTE CJNE A,#2EH,M47 MOV R2,#52 JMP DSP_M M47: MOV A,MINUTE CJNE A,#2FH,M48 MOV R2,#53 JMP DSP_M M48: MOV A,MINUTE CJNE A,#30H,M49 MOV R2,#54 JMP DSP_M M49: MOV A,MINUTE CJNE A,#31H,M50 MOV R2,#55 JMP DSP_M M50: MOV A,MINUTE CJNE A,#32H,M51 MOV R2,#56 JMP DSP_M M51: MOV A,MINUTE CJNE A,#33H,M52 MOV R2,#57 JMP DSP_M M52: MOV A,MINUTE CJNE A,#34H,M53 MOV R2,#58 JMP DSP_M M53: MOV A,MINUTE CJNE A,#35H,M54 MOV R2,#59 JMP DSP_M M54: MOV A,MINUTE CJNE A,#36H,M55 MOV R2,#61 JMP DSP_M M55: MOV A,MINUTE CJNE A,#37H,M56 MOV R2,#62 JMP DSP_M M56: MOV A,MINUTE CJNE A,#38H,M57 MOV R2,#63 JMP DSP_M M57: MOV A,MINUTE CJNE A,#39H,M58 MOV R2,#64 JMP DSP_M M58: MOV A,MINUTE CJNE A,#3AH,M59 MOV R2,#65 JMP DSP_M M59: MOV A,MINUTE MOV R2,#66
DSP_M: LCALL DELAY MOV P1,#0FFH MOV P3,#0FFH LCALL DELAY_DSP MOV P1,#00H MOV P3,#00H
H0: MOV A,P2 CJNE A,#0FFH,H0 MOV A,HOUR CJNE A,#00H,H1 MOV P1,#0FFH MOV P3,#0FFH LCALL DELAY_DSP MOV P1,#00H MOV P3,#00H JMP CHECK_SW H1: MOV A,HOUR CJNE A,#01H,H2 MOV R2,#6 JMP DSP_H H2: MOV A,HOUR CJNE A,#02H,H3 MOV R2,#10 JMP DSP_H H3: MOV A,HOUR CJNE A,#03H,H4 MOV R2,#16 JMP DSP_H H4: MOV A,HOUR CJNE A,#04H,H5 MOV R2,#21 JMP DSP_H H5: MOV A,HOUR CJNE A,#05H,H6 MOV R2,#27 JMP DSP_H H6: MOV A,HOUR CJNE A,#06H,H7 MOV R2,#33 JMP DSP_H H7: MOV A,HOUR CJNE A,#07H,H8 MOV R2,#38 JMP DSP_H H8: MOV A,HOUR CJNE A,#08H,H9 MOV R2,#45 JMP DSP_H H9: MOV A,HOUR CJNE A,#09H,H10 MOV R2,#51 JMP DSP_H H10: MOV A,HOUR CJNE A,#0AH,H11 MOV R2,#56 JMP DSP_H H11: MOV A,HOUR MOV R2,#61
DSP_H: LCALL DELAY MOV P1,#0FFH LCALL DELAY_DSP MOV P1,#00H JMP CHECK_SW
DELAY_DSP: MOV R2,#1 DELAY_DSP1: MOV R3,#085H DELAY_DSP2: DJNZ R3,DELAY_DSP2 DJNZ R2,DELAY_DSP1 RET DELAY: MOV R3,#0E5H DELAY1: NOP NOP DJNZ R3,DELAY1 DJNZ R2,DELAY RET
END
|