tceic.com
>> >>


SEC EQU 30H ;:
MIN EQU 31H ;
HOU EQU 32H ;

YEAR1 EQU 33H ;:1
YEAR2 EQU 34H ;2
MONTH EQU 35H ;
DAY EQU 36H ;

NUM EQU 37H ;
ALARM_RING EQU 38H ;RING10
NUM_KEY EQU 39H ;
ALARM_X EQU 3AH ;
ALARM_ON_OFF EQU 3BH;10
YEAR_CHECK EQU 3CH ;01

DAY_MAX EQU 3DH ;
YES_RING EQU 3EH ;Ҧ
ALARM_1_SEC EQU 40H ;1
ALARM_1_MIN EQU 41H
ALARM_1_HOU EQU 42H

ALARM_2_SEC EQU 43H ;2
ALARM_2_MIN EQU 44H
ALARM_2_HOU EQU 45H

ALARM_3_SEC EQU 46H ;3
ALARM_3_MIN EQU 47H
ALARM_3_HOU EQU 48H

ALARM_4_SEC EQU 49H ;4
ALARM_4_MIN EQU 4AH
ALARM_4_HOU EQU 4BH

ALARM_5_SEC EQU 4CH ;5
ALARM_5_MIN EQU 4DH
ALARM_5_HOU EQU 4EH

SECX EQU 50H ;
MINX EQU 51H
HOUX EQU 52H

ALARM_SEC EQU 53H ;
ALARM_MIN EQU 54H
ALARM_HOU EQU 55H

NUM_D1 EQU 58H ;1120
SEC_XOUT EQU 59H ;
MIN_XOUT EQU 5AH
HOU_XOUT EQU 5BH

NUM_SHIA EQU 60H ;˦
NUM_GEA EQU 61H

NUM_ALARM EQU 70H ;KEY14

NUM_KEYBACK EQU 71H ;1

NUM_L EQU 72H ;
NUM_Q EQU 73H ;

NUM_SHI EQU 75H ;˦˦
NUM_GE EQU 76H ;
LOC_PLACE EQU 77H ;TIME
NUM_ENTER EQU 78H ;
MODE EQU 79H ;01
NUM_ENTER_ALARM EQU 7AH ;
LOC_ALARM EQU 7BH ;
NUM_KEY14 EQU 7CH ;14
NUM_KEY15 EQU 7DH ;151

ORG 0000H
LJMP MAIN
ORG 000BH
LJMP SERVE_TIMER0
ORG 001BH
LJMP SERVE_TIMER1
ORG 0003H
LJMP SERVE_PLACE
ORG 0013H
LJMP SERVE_ALARM
ORG 0020H

MAIN:
MOV TMOD,#11H
MOV NUM_D1,#20

MOV SEC,#59 ;
MOV MIN,#59
MOV HOU,#12

MOV NUM,#0
MOV NUM_KEY,#0
MOV ALARM_X,#0

MOV YEAR1,#19 ;
MOV YEAR2,#89
MOV MONTH,#06
MOV DAY,#06

MOV ALARM_1_SEC,#00 ;1
MOV ALARM_1_MIN,#01
MOV ALARM_1_HOU,#13

MOV ALARM_2_SEC,#00 ;2
MOV ALARM_2_MIN,#58
MOV ALARM_2_HOU,#12

MOV ALARM_3_SEC,#00 ;3
MOV ALARM_3_MIN,#05
MOV ALARM_3_HOU,#13

MOV ALARM_4_SEC,#00 ;4
MOV ALARM_4_MIN,#10
MOV ALARM_4_HOU,#13

MOV ALARM_5_SEC,#00 ;5
MOV ALARM_5_MIN,#20
MOV ALARM_5_HOU,#13
MOV NUM_ENTER,#0
MOV MODE,#0
MOV NUM_ALARM,#0
MOV ALARM_RING,#1 ;

MOV NUM_ENTER_ALARM,#0
MOV YES_RING,#0
MOV NUM_KEY15,#0
;
SETB IT0
SETB IT1
SETB EX0 ;0
SETB EX1 ;1
SETB ET1 ;T1
SETB EA


MOV TH1,#3CH
MOV TL1,#0BH
SETB TR1

/*****************T0******************/
HERE:
LCALL COMPAREANDRING
MOV A,MODE
JZ SHOW
LCALL SET_ALARM
LCALL DISPLAY_ALARM
LJMP HERE
SHOW:
MOV A,NUM
CLR C
SUBB A,#4
JC SHOW_TIME
LCALL TIME_CHANGE_KEY ;
LCALL DISPLAY_CALENDAR
LJMP HERE
SHOW_TIME:
LCALL CHANGE_ADD ;P3.4
LCALL CHANGE_SUB ;P3.5

LCALL TIME_CHANGE_KEY ;
LCALL DISPLAY_TIME ;
LJMP HERE

/*****************1******************/
ORG 0100H
SERVE_TIMER1:
MOV TH1,#3CH
MOV TL1,#0BH
DJNZ NUM_D1,RETURN1 ;20H0
MOV NUM_D1,#20
INC SEC ;
MOV A,SEC
CJNE A,#60,RETURN1
MOV SEC,#0
INC MIN
MOV A,MIN
CJNE A,#60,RETURN1
MOV MIN,#0
INC HOU
MOV A,HOU
CJNE A,#24,RETURN1
MOV HOU,#0

INC DAY ;
LCALL DAYMAX
MOV A,DAY_MAX ;
ADD A,#1
MOV DAY_MAX,A
MOV A,DAY
CLR C
SUBB A,DAY_MAX
JC RETURN1
MOV DAY,#01

INC MONTH
MOV A,MONTH
CJNE A,#13,RETURN1
MOV MONTH,#01
INC YEAR2
MOV A,YEAR2
CJNE A,#100,RETURN1
MOV YEAR2,#00
INC YEAR1
MOV A,YEAR1
CJNE A,#000,RETURN1
MOV YEAR1,#19
RETURN1:
RETI
/*****************0--**********************/
SERVE_TIMER0:
SETB P1.0
MOV TH0,#0FEH
MOV TL0,#0CH
CPL P1.0
RETURN4:
RETI
/******************0************/
ORG 0200H
SERVE_PLACE:
MOV MODE,#0 ;0
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY

INC NUM
MOV A,NUM
CJNE A,#9,RETURN2
MOV NUM,#0
RETURN2:
MOV A,NUM ;
MOV DPTR,#TABLE_PAO
MOVC A,@A+DPTR
MOV P1,A
MOV NUM_ENTER,#0
CLR IE0
MOV ALARM_X,#0
MOV NUM_ALARM,#3
RETI

/*******************1********************/
SERVE_ALARM:
MOV MODE,#1
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY
LCALL DELAY

INC ALARM_X ;
MOV A,ALARM_X
CJNE A,#6,RETURN3
MOV ALARM_X,#0
RETURN3:
MOV NUM_ALARM,#0 ;0

MOV A,#0 ;
MOV DPTR,#TABLE_PAO
MOVC A,@A+DPTR
MOV P1,A
CLR IE1
MOV NUM,#8
RETI



/*******************************************/
SET_ALARM:
MOV A,ALARM_X
CJNE A,#1,SET_ALARM_BACK
SET_ALARM1:
MOV SECX,40H
MOV MINX,41H
MOV HOUX,42H
LCALL CHECK_KEY14
MOV A,NUM_ALARM
CJNE A,#1,SET_ALARM1_2
SET_ALARM1_1:
LCALL ALARM_CHANGE_KEY
MOV SECX,40H
LJMP SET_ALARM_BACK
SET_ALARM1_2:
MOV A,NUM_ALARM
CJNE A,#2,SET_ALARM1_3
LCALL ALARM_CHANGE_KEY
MOV MINX,41H
LJMP SET_ALARM_BACK
SET_ALARM1_3:
MOV A,NUM_ALARM
CJNE A,#3,SET_ALARM_BACK
LCALL ALARM_CHANGE_KEY
MOV HOUX,42H
LJMP SET_ALARM_BACK
SET_ALARM_BACK:
RET
/*SET_ALARM2:
MOV A,ALARM_X
CJNE A,#2,SET_ALARM3
LCALL CHECK_KEY14
; MOV A,NUM_KEY14
; JZ SET_ALARM_BACK
LCALL ALARM_CHANGE_KEY
LCALL DELAY1
MOV SECX,43H
MOV MINX,44H
MOV HOUX,45H
LJMP SET_ALARM_BACK
SET_ALARM_BACK:
RET
SET_ALARM3:
MOV A,ALARM_X
CJNE A,#3,SET_ALARM4
LCALL CHECK_KEY14
MOV A,NUM_KEY14
JZ SET_ALARM_BACK
LCALL ALARM_CHANGE_KEY
LCALL DELAY1
MOV SECX,46H
MOV MINX,47H
MOV HOUX,48H
LJMP SET_ALARM_BACK
SET_ALARM4:
MOV A,ALARM_X
CJNE A,#4,SET_ALARM5
LCALL CHECK_KEY14
MOV A,NUM_KEY14
JZ SET_ALARM_BACK
LCALL ALARM_CHANGE_KEY
LCALL DELAY1
MOV SECX,49H
MOV MINX,4AH
MOV HOUX,4BH
LJMP SET_ALARM_BACK
SET_ALARM5:
MOV A,ALARM_X
CJNE A,#5,SET_ALARM_BACK
LCALL CHECK_KEY14
MOV A,NUM_KEY14
JZ SET_ALARM_BACK
LCALL ALARM_CHANGE_KEY
LCALL DELAY1
MOV SECX,4CH
MOV MINX,4DH
MOV HOUX,4EH
LJMP SET_ALARM_BACK */



/*CHECK_ALARM_ON_OFF: ;10
LCALL KEYNUM
MOV A,KEYNUM_BACK
JZ CHECK_ALARM_ON_OFF_BACK
MOV A,NUM_KEY
CJNE A,#15,CHECK_ALARM_ON_OFF_BACK
MOV ALARM_RING,#1
LJMP CHECK_ALARM_ON_OFF_BACK
CHECK_ALARM_ON_OFF1:
MOV ALARM_RING,#0
CHECK_ALARM_ON_OFF_BACK:
RET */

CHECK_KEY14: ;14
LCALL KEYNUM
MOV A,NUM_KEYBACK
JZ CHECK_KEY14_BACK
MOV A,NUM_KEY
CJNE A,#14,CHECK_KEY14_BACK
INC NUM_ALARM
LCALL DELAY
; MOV NUM_KEY14,#1
MOV NUM_ENTER_ALARM,#0
MOV A,NUM_ALARM
CJNE A,#4,CHECK_KEY14_BACK
MOV NUM_ALARM,#0
CHECK_KEY14_BACK:
MOV A,NUM_ALARM ;
MOV DPTR,#TABLE_PAO
MOVC A,@A+DPTR
MOV P1,A
RET

ALARM_CHANGE_KEY: ;*************************/
MOV A,NUM_ENTER_ALARM
JZ KEYNUM_11
LJMP KEYNUM_22
KEYNUM_11:
LCALL CHECK_KEY
JZ ALARM_CHANGE_KEY_BACK
LCALL CHECK_NUM_KEY
MOV NUM_SHIA,NUM_KEY
MOV NUM_ENTER_ALARM,#1
LCALL DELAY1
LCALL CHANGE_SHI_ALARM
LJMP ALARM_CHANGE_KEY_BACK
KEYNUM_22:
LCALL CHECK_KEY
JZ ALARM_CHANGE_KEY_BACK
LCALL CHECK_NUM_KEY
MOV NUM_GEA,NUM_KEY
LCALL DELAY1
MOV NUM_ENTER_ALARM,#0
LCALL CHANGE_GE_ALARM
ALARM_CHANGE_KEY_BACK:
RET

CHANGE_SHI_ALARM: ;
MOV A,NUM_ALARM
LCALL CHOOSE_TABLE_ALARM
MOV A,NUM_ALARM
MOVC A,@A+DPTR
MOV LOC_ALARM,A
MOV R0,A
MOV A,@R0
MOV B,#10
DIV AB
MOV R5,B
MOV A,NUM_SHIA
MOV B,#10
MUL AB
ADD A,R5
MOV R1,A
MOV R0,LOC_ALARM
MOV A,R1
MOV @R0,A
RET

CHANGE_GE_ALARM: ;
MOV A,NUM_ALARM
LCALL CHOOSE_TABLE_ALARM
MOV A,NUM_ALARM
MOVC A,@A+DPTR
MOV LOC_ALARM,A
MOV R0,A
MOV A,@R0
MOV B,#10
DIV AB
MOV B,#10
MUL AB
ADD A,NUM_GEA
MOV R1,A
MOV R0,LOC_ALARM
MOV A,R1
MOV @R0,A
RET

CHOOSE_TABLE_ALARM:
MOV A,ALARM_X
CJNE A,#1,A_2
MOV DPTR,#TABLE_ALARM1
LJMP CHOOSE_TABLE_ALARM_BACK
A_2:
CJNE A,#2,A_3
MOV DPTR,#TABLE_ALARM2
LJMP CHOOSE_TABLE_ALARM_BACK
A_3:
CJNE A,#3,A_4
MOV DPTR,#TABLE_ALARM3
LJMP CHOOSE_TABLE_ALARM_BACK
A_4:
CJNE A,#4,A_5
MOV DPTR,#TABLE_ALARM4
LJMP CHOOSE_TABLE_ALARM_BACK
A_5:
CJNE A,#5,A_0
MOV DPTR,#TABLE_ALARM5
A_0:
NOP
CHOOSE_TABLE_ALARM_BACK:
RET

TABLE_ALARM1:
DB 00H,40H,41H,42H
TABLE_ALARM2:
DB 00H,43H,44H,45H
TABLE_ALARM3:
DB 00H,46H,47H,48H
TABLE_ALARM4:
DB 00H,49H,4AH,4BH
TABLE_ALARM5:
DB 00H,4CH,4DH,4EH

/*******************************/
COMPAREANDRING:
MOV A,ALARM_X
CJNE A,#1,CR2
CR1:
MOV ALARM_SEC,40H
MOV ALARM_MIN,41H
MOV ALARM_HOU,42H
LCALL COMPARE_RING
LJMP COMPAREANDRING_BACK
CR2:
MOV A,ALARM_X
CJNE A,#2,CR3
MOV ALARM_SEC,43H
MOV ALARM_MIN,44H
MOV ALARM_HOU,45H
LCALL COMPARE_RING
LJMP COMPAREANDRING_BACK
CR3:
MOV A,ALARM_X
CJNE A,#2,CR4
MOV ALARM_SEC,46H
MOV ALARM_MIN,47H
MOV ALARM_HOU,48H
LCALL COMPARE_RING
LJMP COMPAREANDRING_BACK
CR4:
MOV A,ALARM_X
CJNE A,#2,CR5
MOV ALARM_SEC,49H
MOV ALARM_MIN,4AH
MOV ALARM_HOU,4BH
LCALL COMPARE_RING
LJMP COMPAREANDRING_BACK
CR5:
MOV A,ALARM_X
CJNE A,#2,COMPAREANDRING_BACK
MOV ALARM_SEC,4CH
MOV ALARM_MIN,4DH
MOV ALARM_HOU,4EH
LCALL COMPARE_RING
COMPAREANDRING_BACK:
RET

COMPARE_RING:
MOV A,YES_RING ;0
JNZ STOP_RING
RING_CHECK:
LCALL COMPARE
LJMP COMPARE_RING_BACK
STOP_RING:
LCALL CHECK_KEY15
MOV A,NUM_KEY15
JNZ COMPARE_RING_BACK
MOV A,ALARM_HOU
CJNE A,HOU,COMPARE_RING_BACK
MOV A,ALARM_MIN
ADD A,#1
CJNE A,MIN,COMPARE_RING_BACK
MOV YES_RING,#0
CLR TR0
COMPARE_RING_BACK:
RET

COMPARE:
MOV A,ALARM_HOU
CJNE A,HOU,COMPARE_BACK
MOV A,ALARM_MIN
CJNE A,MIN,COMPARE_BACK
SETB ET0
SETB EA
MOV TH0,#0FEH
MOV TL0,#0CH
SETB TR0
MOV YES_RING,#1
COMPARE_BACK:
RET

CHECK_KEY15: ;15
LCALL KEYNUM
MOV A,NUM_KEYBACK
JZ CHECK_KEY15_BACK
MOV A,NUM_KEY
CJNE A,#15,CHECK_KEY15_BACK1
CLR TR0
; MOV YES_RING,#0
MOV NUM_KEY15,#1
LJMP CHECK_KEY15_BACK
CHECK_KEY15_BACK1:
MOV NUM_KEY15,#0
CHECK_KEY15_BACK:
RET
/*************************************/
TIME_CHANGE_KEY:
MOV A,NUM_ENTER
JZ KEYNUM_1
LJMP KEYNUM_2
KEYNUM_1:
LCALL CHECK_KEY
JZ TIME_CHANGE_KEY_BACK
LCALL CHECK_NUM_KEY
MOV NUM_SHI,NUM_KEY
INC NUM_ENTER
LCALL DELAY1
LCALL CHANGE_SHI
LJMP TIME_CHANGE_KEY_BACK
KEYNUM_2:
LCALL CHECK_KEY
JZ TIME_CHANGE_KEY_BACK
LCALL CHECK_NUM_KEY
MOV NUM_GE,NUM_KEY
LCALL DELAY1
MOV NUM_ENTER,#0
LJMP CHANGE_GE
TIME_CHANGE_KEY_BACK:
RET

/**********************************************/
CHECK_KEY:
LCALL KEYNUM ;
MOV A,NUM_KEYBACK
RET

/*********************˦*********************/
CHANGE_SHI: ;
MOV A,NUM
MOV DPTR,#TABLE_PLACE
MOVC A,@A+DPTR
MOV LOC_PLACE,A
MOV R0,A
MOV A,@R0
MOV B,#10
DIV AB
MOV R5,B
MOV A,NUM_SHI
MOV B,#10
MUL AB
ADD A,R5
MOV R1,A
MOV R0,LOC_PLACE
MOV A,R1
MOV @R0,A
RET

CHANGE_GE: ;
MOV A,NUM
MOV DPTR,#TABLE_PLACE
MOVC A,@A+DPTR
MOV LOC_PLACE,A
MOV R0,A
MOV A,@R0
MOV B,#10
DIV AB
MOV B,#10
MUL AB
ADD A,NUM_GE
MOV R1,A
MOV R0,LOC_PLACE
MOV A,R1
MOV @R0,A
RET
TABLE_PLACE:
DB 00H,SEC,MIN,HOU,00H,DAY,MONTH,YEAR2,YEAR1

/*******************************************/
KEYNUM:
MOV NUM_L,#0
MOV R4,#0FEH
JUDGE:
LCALL DELAY
MOV DPTR,#8000H
MOV A,#00H
MOVX @DPTR,A ;
MOVX A,@DPTR ;
ANL A,#0FH
CJNE A,#0FH,RKEY ;
MOV NUM_KEYBACK,#0
LJMP KEYNUM_BACK
RKEY: ;NUM_Q
LCALL DELAY
ROW0:
JB ACC.0,ROW1 ;1
MOV NUM_Q,#0
ROW1:
JB ACC.1,ROW2
MOV NUM_Q,#1
ROW2:
JB ACC.2,ROW3
MOV NUM_Q,#2
ROW3:
JB ACC.3,LKEY
MOV NUM_Q,#3
LKEY:
MOV DPTR,#8000H
MOV A,R4
MOVX @DPTR,A
MOVX A,@DPTR
ORL A,#0F0H
CPL A
JNZ KEYS ;A0
INC NUM_L
MOV A,R4
RL A
MOV R4,A ;NUM_L
LJMP LKEY
KEYS:
MOV A,NUM_L
MOV B,#4
MUL AB
ADD A,NUM_Q
MOV NUM_KEY,A ;
MOV NUM_KEYBACK,#1
KEYNUM_BACK:
RET

/******************9********************/
CHECK_NUM_KEY:
MOV A,NUM_KEY
CLR C
SUBB A,#10
JC CHECK_NUM_KEY_BACK
MOV NUM_KEY,#00
CHECK_NUM_KEY_BACK:
RET


/********************************************/
DISPLAY_ALARM:
MOV A,#7FH
LCALL LED_SEL
MOV A,ALARM_X
LCALL LED_SEG
LCALL DELAY

/* MOV A,ALARM_ON_OFF
JZ DISPLAY_TIME_ALARM
MOV A,#0BFH
LCALL LED_SEL
MOV DPTR,#TABLE
MOV A,#40H
MOVX @DPTR,A
LCALL LED_SEG
LCALL DELAY */
DISPLAY_TIME_ALARM:
MOV SEC_XOUT,SECX
LCALL SEC_OUT
MOV SECX,SEC_XOUT ;
MOV A,SECX ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0FDH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FEH
LCALL LED_SEL
LCALL DELAY

MOV MIN_XOUT,MINX
LCALL MIN_OUT ;
MOV MINX,MIN_XOUT
MOV A,MINX ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0F7H
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FBH
LCALL LED_SEL
LCALL DELAY

MOV HOU_XOUT,HOUX
LCALL HOU_OUT ;
MOV HOUX,HOU_XOUT
MOV A,HOUX ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0DFH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0EFH
LCALL LED_SEL
LCALL DELAY
RET
/******************************************/
DISPLAY_TIME:
MOV SEC_XOUT,SEC
LCALL SEC_OUT ;
MOV SEC,SEC_XOUT
MOV A,SEC ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0FDH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FEH
LCALL LED_SEL
LCALL DELAY

MOV MIN_XOUT,MIN
LCALL MIN_OUT ;
MOV MIN,MIN_XOUT
MOV A,MIN ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0F7H
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FBH
LCALL LED_SEL
LCALL DELAY

MOV HOU_XOUT,HOU
LCALL HOU_OUT ;
MOV HOU,HOU_XOUT
MOV A,HOU ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0DFH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0EFH
LCALL LED_SEL
LCALL DELAY
RET
/*****************************************/
DISPLAY_CALENDAR:
MOV A,YEAR1 ;1
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#07FH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0BFH
LCALL LED_SEL
LCALL DELAY

MOV A,YEAR2 ;2
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0DFH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0EFH
LCALL LED_SEL
LCALL DELAY

LCALL MONTH_OUT
MOV A,MONTH ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0F7H
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FBH
LCALL LED_SEL
LCALL DELAY

LCALL DAY_OUT
MOV A,DAY ;
MOV B,#10
DIV AB
LCALL LED_SEG
MOV A,#0FDH
LCALL LED_SEL
LCALL DELAY
MOV A,B
LCALL LED_SEG
MOV A,#0FEH
LCALL LED_SEL
LCALL DELAY
RET

/*******************************************/
SEC_OUT: ;
MOV A,SEC_XOUT
CLR C
SUBB A,#60
JC SEC_OUT_BACK
MOV SEC_XOUT,#0
SEC_OUT_BACK:
RET

MIN_OUT: ;
MOV A,MIN_XOUT
CLR C
SUBB A,#60
JC MIN_OUT_BACK
MOV MIN_XOUT,#0
MIN_OUT_BACK:
RET

HOU_OUT: ;
MOV A,HOU_XOUT
CLR C
SUBB A,#24
JC HOU_OUT_BACK
MOV HOU_XOUT,#0
HOU_OUT_BACK:
RET
;
DAY_OUT:
MOV A,DAY
CJNE A,#00,DAY_OUT1
LJMP DAY_OUT2
DAY_OUT1:
LCALL DAYMAX
MOV A,DAY_MAX
ADD A,#1
MOV R0,A
MOV A,DAY
CLR C
SUBB A,R0
JC DAY_OUT_BACK
DAY_OUT2:
MOV DAY,#01
DAY_OUT_BACK:
RET


DAYMAX: ;
LCALL YEAR_OUT
MOV A,YEAR_CHECK
JZ YES_LEAP_DAY1
NO_LEAP_DAY1:
MOV DPTR,#TABLE_NO_LEAP_DAY
LJMP DAY_MAX1
YES_LEAP_DAY1:
MOV DPTR,#TABLE_YES_LEAP_DAY
LJMP DAY_MAX2
DAY_MAX1:
MOV A,MONTH
MOVC A,@A+DPTR
MOV DAY_MAX,A
LJMP DAY_MAX_BACK
; ADD A,#1
; MOV R0,A
; MOV A,DAY
; CLR C
; SUBB A,R0
; JC DAY_OUT2
; MOV DAY,#30
DAY_MAX2:
MOV A,MONTH
MOVC A,@A+DPTR
MOV DAY_MAX,A
DAY_MAX_BACK:
RET

MONTH_OUT: ;
CLR C
MOV A,MONTH
SUBB A,#13
JC MONTH_OUT1
MOV MONTH,#01
MONTH_OUT1:
MOV A,MONTH
JNZ MONTH_OUT_BACK
MOV MONTH,#01
MONTH_OUT_BACK:
LCALL DAY_OUT
RET

YEAR_OUT: ;
MOV A,YEAR2
MOV B,#4
DIV AB
MOV A,B
JNZ NO_LEAP ;4
MOV A,YEAR2
JNZ YES_LEAP
MOV A,YEAR1
MOV B,#4
DIV AB
MOV A,B
JZ YES_LEAP
NO_LEAP:
MOV YEAR_CHECK,#1
LJMP YEAR_OUT_BACK
YES_LEAP:
MOV YEAR_CHECK,#0
YEAR_OUT_BACK:
RET

TABLE_NO_LEAP_DAY:
DB 100,31,28,31,30,31,30,31,31,30,31,30,31
TABLE_YES_LEAP_DAY:
DB 100,31,29,31,30,31,30,31,31,30,31,30,31

/*********************************/
LED_SEL:
MOV DPTR,#8300H
MOVX @DPTR,A
RET
LED_SEG:
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV DPTR,#8200H
MOVX @DPTR,A
RET

/*****************************************/
DELAY:
MOV R6,#80
L1:
MOV R7,#8
L2:
DJNZ R7,L2
DJNZ R6,L1
RET

DELAY1:
MOV R6,#250
L11:
MOV R7,#250
L22:
DJNZ R7,L22
DJNZ R6,L11
RET

TABLE:
DB 3FH,06H,5BH,4FH
DB 66H,6DH,7DH,07H
DB 7FH,6FH
TABLE_PAO:
DB 0FFH,0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH,7FH

/******************************/
CHANGE_ADD:
MOV A,NUM
CJNE A,#1,LP1

CHANGE_ADDSEC: ;1
JB P3.4,LOOP
LP_ADDSEC:
LCALL DELAY
JNB P3.4,LP_ADDSEC
INC SEC
LCALL DELAY
MOV A,SEC
ADD A,NUM_KEY
SEC1:
MOV A,SEC
CJNE A,#60,LOOP
MOV SEC,#0
LJMP LOOP
LP1:
MOV A,NUM
CJNE A,#2,LP2

CHANGE_ADDMIN: ;1
JB P3.4,LOOP
LP_ADDMIN:
LCALL DELAY
JNB P3.4,LP_ADDMIN
INC MIN
MOV A,MIN
CJNE A,#60,LOOP
MOV MIN,#0
LJMP LOOP
LP2:
MOV A,NUM
CJNE A,#3,LOOP

CHANGE_ADDHOU: ;1
JB P3.4,LOOP
LP_ADDHOU:
LCALL DELAY
JNB P3.4,LP_ADDHOU
INC HOU
MOV A,HOU
CJNE A,#24,LP3
MOV HOU,#0
LP3:
MOV A,NUM
CJNE A,#4,LOOP
LOOP:
RET

/************************************/
CHANGE_SUB:
MOV A,NUM
CJNE A,#1,LOP1

CHANGE_SUBSEC: ;1
JB P3.5,LOOP1
LP_SUBSEC:
LCALL DELAY
JNB P3.5,LP_SUBSEC
MOV A,SEC
JZ LK1
DEC SEC
LJMP LOOP1
LK1:
MOV SEC,#59
LJMP LOOP1
LOP1:
MOV A,NUM
CJNE A,#2,LOP2

CHANGE_SUBMIN: ;1
JB P3.5,LOOP1
LP_SUBMIN:
LCALL DELAY
JNB P3.5,LP_SUBMIN
MOV A,MIN
JZ LK2
DEC MIN
LJMP LOOP1
LK2:
MOV MIN,#59
LJMP LOOP1
LOP2:
MOV A,NUM
CJNE A,#3,LOP3

CHANGE_SUBHOU: ;1
JB P3.5,LOOP1
LP_SUBHOU:
LCALL DELAY
JNB P3.5,LP_SUBHOU
MOV A,HOU
JZ LK3
DEC HOU
LJMP LOOP1
LK3:
MOV HOU,#23
LJMP LOOP1
LOP3:
MOV A,NUM
CJNE A,#0,LOOP1
LOOP1:
RET
END


:

51_.pdf

51 - 51

.doc

___ () ) UDC ...

.txt

- : ORG 0000H ; LJM

51.doc

51_/__ |0|0|51_/__SEC 32H ; ...

.doc

- :11060120

.doc

__IT/_,

.doc

- :11060120

.doc

- 2010-09-30 20:

.txt

- ;24,8,

().doc

() - () ) () : : ˦˦ ...

.doc

___ hour_h data 30h hour_l data 31h min_h data 32h min_l data 33h ...

.doc

- : ORG 0000H LJMP MAIN O

51.doc

51 - :1 :

51(....pdf

51() - 2009-06-25 :...

8.doc

8 - ) (8 ,,...

++++.txt

++++___;--- ... 12 1 AT89C2051LED... 7 1...

.doc

- : : : : : : : : ...

-- -....doc

-- -_IT/_.../, 13 , ...

-10()l.doc

WINDOW S,,..., ...

.pdf

___ ... 9 , 1, 5 , 1...

|
All rights reserved Powered by www.tceic.com
copyright ©right 2010-2021
zhit325@126.com