Electronic clock design
1, circuit diagram:
2 function realization:
(1. Connect the P 1.0-P 1.7 port in the "Single Chip Microcomputer System" area to the A-H port in the "Dynamic Digital Display" area with an 8-core cable;
(2) Connect the P3.0-P3.7 port in "MCU System: Area" to the S 1-S8 port in "Dynamic Digital Display" area with an 8-core cable;
(3) Connect the ports P0.0/AD0, P0. 1/AD 1 and P0.2/AD2 in the area of "single chip microcomputer system" to the ports SP3, SP2, SP1in the area of "independent keyboard" by wires respectively;
3, program block diagram:
6. Assemble the source program
HOURK bit P 1.2
MINITEK bit P 1. 1
SECONDK bit P 1.0
Second EQU 30H
Minite EQU 3 1H
EQU time 32 hours
Tissue 00H
LJMP start
Tissue 0BH
LJMP INT_T0
ORG 0030H
Start:
MOV second, #00H
MOV Mini, #00H
MOV time, # 12
MOV R0,#00H
MOV TMOD,#0 1H
MOV TH0,#3CH
MOV TL0,#0B0H
SETB Electronic Arts Circle
SETB ET0
SETB TR0
Next: MOV A, #7FH
MOV·P3
MOV one hour
MOV B,# 10
Division AB
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
MOV A,#0BFH
MOV·P3
MOV A,B
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
MOV A,#0DFH
MOV·P3
mov p2,#40h
Call delay
Move a, #0efh
mov p3,a
Minit ·MOV
MOV B,# 10
Division AB
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
MOV A,#0F7H
MOV·P3
MOV A,B
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
MOV A,#0FBH
MOV·P3
mov p2,#40h
Call delay
MOV A # 0 fdh
MOV·P3
MOV A, second
MOV B,# 10
Division AB
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
MOV A,#0FEH
MOV·P3
MOV A,B
MOV·DPTR # table
MOVC A,@A+DPTR
MOV·P2
Call delay
Weight: JB SECONDK, NK 1
LCALL dely 10 ms
JB SECONDK,NK 1
JNB Middle School, USD
INC seconds
MOV A, second
CJNE A,#60,NK 1
MOV second, #00H
NK 1: JB MINITEK,NK2
LCALL dely 10 ms
JB MINITEK,NK2
JNB· Minitek, USD
INC MINITE
Minit ·MOV
CJNE A,#60,NK2
MOV Mini, #00H
NK2: JB HOURK,NK3
LCALL dely 10 ms
JB HOURK,NK3
JNB· Hawke, USD
INC hours
MOV one hour
CJNE A,#24,NK3
MOV time, #00
NK3:
MOV A,R0
CJNE A,#20,NEXT 1
MOV R0,#0
INC seconds
MOV A, second
CJNE A,#60,NEXT 1
MOV Second, #0
INC MINITE
Minit ·MOV
CJNE A,#60,NEXT 1
MOV Mini, #0
INC hours
MOV one hour
CJNE A,#24,NEXT 1
MOV time, #0
Next 1:JMP Next
Table: DB 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H, 7FH, 6FH, 40H.
INT_T0: CLR TR0
INC R0
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR0
Retty
Delay:
MOV·R6, ranked second
D 1: MOV R7,#248
DJNZ R7, USD
DJNZ R6,D 1
Soak in water to soften
Dely 10 ms:
MOV R6,# 10
DD 1: MOV R7,#248
DJNZ R7, USD
DJNZ R6,DD 1
Soak in water to soften
end