times New="New" Roman'; mso-hansi-font-family: 'Times New="New" Roman'; mso-bidi-font-family: 'Times New="New" Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">万年历实验: RW EQU P2.4 RS EQU P2.3 DY EQU 70H ;该年一月一号到2000年一月一 ;号的星期差 DM EQU 71H ;以前月引起的星期差 M2 EQU 72H ;二月引起的星期差 MONTH EQU 73H ;月的天数 DAYS EQU 74H ;某一天 WEEK EQU 75H ;该天的星期信息 YEARS EQU 76H ;存放年份 MONTHS EQU 77H ;存放月份 ORG 0000H AJMP 0100H ORG 000BH AJMP INTERRUPT ORG 0100H ACALL INIT_0 ;液晶初始化 ACALL TIMER ;定时器初始化 ACALL INIT_1 ;变量初始化 AG0: ACALL KEY_SCAN ;键盘扫描 JNB 20H.7, FUN0 JNB 20H.6, FUN1 JNB 20H.5, FUN2 JNB 20H.4, FUN3 JNB 20H.3, FUN4 CJNE R5, #01H, AG0 ;每一妙更新显示数据 AG1: ACALL AG ;调用显示处理程序 SJMP AG0 /************************************* 按键处理 *************************************/ FUN0: MOV 20H, #0FFH ;时加一 INC 37H MOV R6, 37H CJNE R6, #18H, F0_NE MOV 37H, #00H F0_NE: SJMP AG1 FUN1: MOV 20H, #0FFH ;分钟值加一 INC 36H MOV R6, 36H CJNE R6, #3CH, F1_NE MOV 36H, #00H F1_NE: SJMP AG1 FUN2: MOV 20H, #0FFH ;日期加一 MOV A, MONTH CJNE A, DAYS, F2_NE MOV DAYS, #01H SJMP AG1 F2_NE: INC DAYS SJMP AG1 FUN3: MOV 20H, #0FFH ;月份加一 MOV R6, MONTHS CJNE R6, #12, F3_NE0 MOV MONTHS, #01H SJMP F3_NE F3_NE0: INC MONTHS F3_NE: SJMP AG1 FUN4: MOV 20H, #0FFH ;年份加一 MOV R6, YEARS CJNE R6, #200, F4_NE MOV YEARS, #00H SJMP AG1 F4_NE: INC YEARS SJMP AG1 TAB: DB ‘SUN.MON.TUE.WED.THU.FRI.SAT.' /******************************************* 数值转换处理函数 *******************************************/ AG: ACALL SETDATE ;处理日期数值 MOV R2, #01H ;显示日期 MOV R3, #01H ACALL LOCATE MOV R4, #0CH MOV R1, #60H ACALL DISPLAY MOV DPTR, #TAB ;显示星期 MOV A, WEEK MOV B, #04H MUL AB MOV 31H, A MOV R4, #05H SO: DJNZ R4, S1 ;显示完日期再显示时间 MOV R2, #04H MOV R3, #02H ACALL LOCATE MOV R4, #09H MOV R1, #41H ACALL DISPLAY RET S1: MOVC A,@A+DPTR MOV R0, A ACALL LWD INC 31H MOV A, 31H SJMP SO /******************************************** 键盘扫描 *********************************************/ KEY_SCAN: ORL P1, #0E0H
1
|
|
|
|