Home > Back-end >  Will be compiled into C
Will be compiled into C

Time:09-25

ORG 0000 h
LJMP MAIN
ORG 000 bh
LJMP TIME
; X x x x x part of the main program: x x x x x
ORG 0100 h
MAIN: MOV SP, # 50 h
MOV h, 20 # 00 h; Seconds BIN
MOV 21 h # 00 h; Minutes BIN
MOV 22 h, # 00 h; Hours BIN
MOV 23 h, # 01 h
24 h MOV, # 01 h
MOV 25 h, # 00 h
MOV h, 30 # 00 h
31 h MOV, # 00 h
MOV 32 h # 00 h
MOV 33 h # 00 h
MOV 34 h # 00 h
MOV 35 h, # 00 h
MOV 36 h, # 01 h
MOV 37 h, # 00 h
MOV 38 h, # 01 h
39 h, MOV # 00 h
MOV TMOD, # 01 h; A 16-bit counter
MOV TH0, # 3 ch; Fu count initial
MOV TL0, # 0 b0h
MOV, IE # 10000111 b
SETB TR0; T0 start counting
MOV R2, # 14 h
LOOP: LCALL TIMEPRO
LCALL DISPLAY1
JB P1.1, M1
LCALL SETTIME; Call set time program
LJMP LOOP
M1: JB P1.2, M2
LCALL SETATIME
LJMP LOOP
M2: JB P1.4, M4
LCALL LOOKATIME; Call to set the alarm clock time program
The M4: LJMP LOOP
DELAY: MOV R4, # 030 h; Delay time
DL00: MOV R5, # 0 FFH
DL11: MOV R6, # 9 h
DL12: DJNZ R6, DL12
DJNZ R5, DL11
DJNZ R4, DL00
RET
SETTIME:
L0: LCALL DISPLAY1
MM1: JB P1.2, L1
MOV C, P1.2
JC MM1
LCALL DELAY1; Call delay
JC MM1
MSTOP1: MOV C, P1.2
JNC MSTOP1; Whether P1.2 release? Release continues to
LCALL DELAY1; Call delay
MOV C, P1.2
JNC MSTOP1
INC 22 h. 1
hourMOV. A, 22 h
CJNE A, # 18 h, GO12; Judgment to 24 hours? Not to continue to cycle
MOV 22 h, # 00 h; Hours reset
MOV 34 h # 00 h
MOV 35 h, # 00 h
LJMP L0
L1: JB P1.3, L2
MOV C, P1.3
JC L1
LCALL DELAY1; Delay
JC L1
MSTOP2: MOV C, P1.3
JNC MSTOP2; Whether P1.3 release? Release continues to
LCALL DELAY1; Call delay
MOV C, P1.3
JNC MSTOP2
INC 21 h. Minutes add a
MOV. A, 21 h
CJNE A, # 3 ch, GO11
MOV 21 h # 00 h; Minutes reset
MOV 32 h # 00 h
MOV 33 h # 00 h
LJMP L0
GO11: MOV, B # 0 ah; The content is divided into high and low two parts of A
DIV AB
MOV 32 h, B
MOV 33 h, A
LJMP L0
GO12: MOV, B # 0 ah
DIV AB
MOV 34 h, B
MOV 35 h, A
LJMP L0
L2: JB P1.4, L0
C, MOV P1.4
JC L2
LCALL DELAY1; Call delay
C, MOV P1.4
JC L2
STOP1:
C, MOV P1.4; To determine whether a button P1.4 release?
JNC STOP1
LCALL DELAY1; Call delay
C, MOV P1.4
JNC STOP1
LJMP LOOP
; Set the alarm clock time x x x x x x x x x x
SETATIME: LCALL DISPLAY2; Call time run
N0: LCALL DISPLAY2
Was: JB P1.3, N1; Whether P1.3 press?
MOV C, P1.3
JC was
LCALL DELAY1
JC was
MSTOP3: MOV C, P1.3; Whether P1.3 release?
JNC MSTOP3
LCALL DELAY1
MOV C, P1.3
JNC MSTOP3
INC 24 h; 1
set hoursMOV. A, 24 h
CJNE A, # 24, GO22
24 h MOV, # 00 h
MOV 38 h, # 00 h
39 h, MOV # 00 h
LJMP N0
N1: JB P1.1, N2; Whether P1.1 press?
C, MOV P1.1
JC N1
LCALL DELAY1
JC N1
MSTOP4: MOV C, P1.1; Whether P1.1 release?
JNC MSTOP4
LCALL DELAY1
C, MOV P1.1
JNC MSTOP4
INC 23 h; Set the alarm clock minutes 1
MOV. A, 23 h
CJNE A, # 60, GO21; Determine whether A to 60 points?
23 h, MOV # 00 h; Minutes reset
MOV 36 h, # 00 h
MOV 37 h, # 00 h
LJMP N0
GO21: MOV, B # 0 ah; The content is divided into high and low two parts of A
DIV AB
MOV 36 h, B
MOV 37 h, A
LJMP N0
GO22: MOV, B # 0 ah
DIV AB
MOV 38 h, B
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related