今天中国论文网小编为大家分享毕业论文、职称论文、论文查重、论文范文、硕博论文库、论文写作格式等内容。
89C51 LED电子钟
程序:
*APPLICATION NOTE E6000 ICEXPLORER ***************
* Title: FOR colk_time *
* Version: 00 *
* Last Updated: *
* MCU: AT89C91 *
* FOR: WWW.PICAVR.COM *
***************************************************
K1 BIT P3.2
K2 BIT P3.4
K3 BIT P3.3
K4 BIT P3.5
C_HOUR EQU 23H
C_MINUTE EQU 24H
C_SECOND EQU 25H
ON_HOUR EQU 26H
ON_MINUTE EQU 27H
OFF_HOUR EQU 28H
OFF_MINUTE EQU 29H
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP WINT0
ORG 000BH
AJMP WTO
ORG 0030H
MAIN: MOV SP,#50H
CLR 00H
MOV 21H,#0
MOV 22H,#0
MOV C_HOUR,#0
MOV C_MINUTE,#0
MOV C_SECOND,#0
MOV ON_HOUR,#0
MOV ON_MINUTE,#0
MOV OFF_HOUR,#0
MOV OFF_MINUTE,#0
MOV TH0,#05
MOV TL0,#05
MOV TMOD,#02H
SETB EA
SETB EX0
CLR ET0
CLR TR0
CLR IT0
M: MOV A,C_HOUR
CJNE A,ON_HOUR,OFF_TIME
MOV A,C_MINUTE
CJNE A,ON_MINUTE,OFF_TIME
SETB P3.7
AJMP NEXT
OFF_TIME: MOV A,C_HOUR
CJNE A,OFF_HOUR,NEXT
MOV A,C_MINUTE
CJNE A,OFF_MINUTE,NEXT
CLR P3.7
NEXT: JNB 00H,M
ACALL DISP1
AJMP M
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H
DISP1: MOV R0,C_HOUR
MOV DPTR,#TAB
MOV A,R0
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.0
ACALL DL ;SEND DISPPLAY HOUR HIGHT BIT
SETB P2.0
MOV A,R0
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.1
ACALL DL
SETB P2.1 ;SEND DISPPLAY HOUR LOW BIT
MOV R1,C_MINUTE
MOV A,R1
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.2
ACALL DL
SETB P2.2 ;SEND DISPPLAY MINUTE HIGHT BIT
MOV A,R1
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.3
ACALL DL
SETB P2.3 ;SEND DISPLAY MINUTE LOW BIT
MOV R2,C_SECOND
MOV A,R2
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.4
ACALL DL
SETB P2.4 ;SEND DISPPLAY SECOND HIGHT BIT
MOV A,R2
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.5
ACALL DL
SETB P2.5 ;SEND DISPPLAY SECOND LOW BIT
RET
WTO: PUSH ACC
PUSH PSW
INC 21H
MOV A,21H
CJNE A,#0C8H,TORETI ;200D=C8H 0.5ms*200=100mS
MOV 21H,#0
INC 22H
MOV A,22H
CJNE A,#10,TORETI ;100ms*10=1S
MOV 22H,#0
CPL P0.0
CPL P0.1
MOV A,#01H
ADD A,C_SECOND
DA A
MOV C_SECOND,A
CJNE A,#60H,TORETI
MOV C_SECOND,#0
MOV A,#01H
ADD A,C_MINUTE
DA A
MOV C_MINUTE,A
CJNE A,#60H,TORETI
MOV C_MINUTE,#0
MOV A,#01H
ADD A,C_HOUR
DA A
MOV C_HOUR,A
CJNE A,#24H,TORETI
MOV C_HOUR,#0
TORETI: POP PSW
POP ACC
RETI
DISP2: MOV R0,ON_HOUR
MOV DPTR,#TAB
MOV A,R0
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.0
ACALL DL
SETB P2.0
MOV A,R0
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.1
ACALL DL
SETB P2.1
MOV R1,ON_MINUTE
MOV A,R1
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.2
ACALL DL
SETB P2.2
MOV A,R1
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.3
ACALL DL
SETB P2.3
RET
DISP3: MOV R0,OFF_HOUR
MOV DPTR,#TAB
MOV A,R0
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.0
ACALL DL
SETB P2.0
MOV A,R0
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.1
ACALL DL
SETB P2.1
MOV R1,OFF_MINUTE
MOV A,R1
SWAP A
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.2
ACALL DL
SETB P2.2
MOV A,R1
ANL A,#0FH
MOVC A,@A+DPTR
MOV P1,A
CLR P2.3
ACALL DL
SETB P2.3
RET
DL: MOV 30H,#02H
DL1: MOV 31H,#0FFH
DL2: DJNZ 31H,DL2
DJNZ 30H,DL1
RET
DEL: MOV 32H,#100
DEL1: MOV 33H,#250
DEL2: DJNZ 33H,DEL2
DJNZ 32H,DEL1
RET
;*********************************************
WINT0: PUSH ACC
PUSH PSW
CLR EX0
CLR TR0
CLR ET0
K1_11:
ACALL DISP1
JB K1,K1_11
K11_1:
。。。。。。。。。。。。。。。。。。。。。。。。。。
具体内容请详阅参考链接:
wWw.lunwen.net.Cn中国论文网免费学术期刊论文发表,目录,论文查重入口,本科毕业论文怎么写,职称论文范文,论文摘要,论文文献资料,毕业论文格式,论文检测降重。 返回作文素材列表