硬件课程设计日历本科论文.doc
《硬件课程设计日历本科论文.doc》由会员分享,可在线阅读,更多相关《硬件课程设计日历本科论文.doc(26页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、2系统模块详细设计与调试1在主程序中要分别对8254和8255初始化编程。具体如下:8254控制字:MOVDX,PORT_8253MOVAL,00110101B;写入控制字,0通道,方式2OUTDX,ALMOVDX,PORT_0MOVAL,00HOUTDX,ALMOVAL,10HOUTDX,ALMOVDX,PORT_8253MOVAL,01110111B;1通道,方式3OUTDX,ALMOVDX,PORT_1MOVAL,00HOUTDX,ALMOVAL,10HOUTDX,AL8255控制字:MOVDX,PORT_8255;8255初始化MOVAL,80HOUTDX,AL程序清单与注释:PORT
2、_A EQU 288H PORT_B EQU 289H PORT_C EQU 28AH PORT_8255 EQU 28BH PORT_0 EQU 280H PORT_1 EQU 281H PORT_2 EQU 282H PORT_8253 EQU 283H DATA SEGMENT ; 0 1 2 3 4 5 6 7 TABLE1 DB 77H,7BH,7DH,7EH,0B7H,0BBH,0BDH,0BEH ; 8 9 A B C D E F DB 0D7H,0DBH,0DDH,0DEH,0E7H,0EBH,0EDH,0EEHHZ_SEC02 DW 0A3B0H HZ_SEC01 DW 0A
3、3B0H HZ_MIN02 DW 0A3B0HHZ_MIN01 DW 0A3B0H HZ_HOU02 DW 0A3B0H HZ_HOU01 DW 0A3B0H HZ_TIM DW 0A1C3H ;符号:HZ_SYM DW 0A1C3H HZ_YEAR02 DW 0A3B0H HZ_YEAR01 DW 0A3B0H HZ_MON02 DW 0A3B1H HZ_MON01 DW 0A3B0H HZ_DAY02 DW 0A3B1H HZ_DAY01 DW 0A3B0H HZ_DATE DW 0A3AFH HZ_WEEK DW 0A3B6H HZ_WEEK01 DW 0D0C7H ;字体星HZ_WEE
4、K02 DW 0C6DAH ;字体期HZ_X DW 0A1EFH ;符号 HZ_W DW 0CDF2H ;字体万HZ_N DW 0C4EAH ;字体年 HZ_R DW 0C8D5H ;字体日 HZ_L DW 0C0FAH ;字体历 HZ_ADR DB ?DATA ENDS STACK1 SEGMENT STACK DW 50 DUP (0) TOP_STAC LABEL WORDSTACK1 ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,STACK1 MOV SS,AX LEA SP,TOP_STAC MOV AX,DATA MO
5、V DS,AX MOV DX,PORT_8255 ;8255初始化 MOV AL,80H OUT DX,AL CALL CLEAR ;LCD清除 CALL FUCTION_A ;日期显示 ;8253的编程 MOV DX,PORT_8253 MOV AL,00110101B ;写入控制字,0通道,方式2 OUT DX,AL MOV DX,PORT_0MOV AL,00H OUT DX,AL MOV AL,10H OUT DX,AL MOV DX,PORT_8253 MOV AL,01110111B;1通道,方式3 OUT DX,AL MOV DX,PORT_1 MOV AL,00H OUT DX
6、,AL MOV AL,10H OUT DX,ALMAIN: LP:MOV DX,PORT_C TEST DX,10H ;检测B口是否有1秒脉冲JNZ LP TEST DX,00H JNZ LPINC HZ_SEC02 ;秒的个位加一 ;判断是否有键按下MOV DX,PORT_8255 MOV AL,10001010B;A口输出B口输入C口低四位输出,高四位输入OUT DX,AL MOV DX,PORT_A ;A口为行,向所有的行输出0MOV AL,00H OUT DX,AL MOV DX,PORT_BRET_TO_1: MOV AL,0FEH MOV CL,ALNEXT_ROW_1: MOV
7、DX,PORT_A OUT DX,AL MOV DX,PORT_B IN AL,DX AND AL,0FH CMP AL,0FH ;判断是否有键按下 JNE JP_1 CMP CL,0EFH JE FUC ROL CL,01 MOV AL,CL JMP NEXT_ROW_1 JP_1: CALL JP FUC: CALL FUCTION_00 ;时间的进位 CALL FUCTION_01 ;日期的进位 CALL FUCTION_02 ;星期的进位 CALL FUCTION_A ;日期显示 JMP MAINFUCTION_00 PROC CMP HZ_SEC02,0A3BAH;判断是否为十,是跳
8、转到秒进位子程序JE TIM_NEXT_01 RET TIM_NEXT_01: INC HZ_SEC01 ;秒的十位加一 MOV HZ_SEC02,0A3B0H ;个位置零 CMP HZ_SEC01,0A3B6H ;判断是否为六,是跳转 JE TIM_NEXT_02 RET TIM_NEXT_02: INC HZ_MIN02 ;分的个位加一 MOV HZ_SEC01,0A3B0H CMP HZ_MIN02,0A3BAH ;判断是否为十,是跳转JE TIM_NEXT_03 RET TIM_NEXT_03: INC HZ_MIN01 ;分的十位加一 MOV HZ_MIN02,0A3B0H CMP
9、HZ_MIN01,0A3B6H ;判断是否大于六,是跳转JE TIM_NEXT_04 RET TIM_NEXT_04: INC HZ_HOU02 ;时的十位加一 MOV HZ_MIN01,0A3B0H CMP HZ_HOU01,0A3B2H ;判断是否为二,是跳转JE TIM_NEXT_05 JMP TIM_NEXT_07 TIM_NEXT_05: CMP HZ_HOU02,0A3B4H ;判断时的个位是否为四,是跳转JE TIM_NEXT_06 JMP TIM_NEXT_07 TIM_NEXT_06: MOV HZ_HOU01,0A3B0H MOV HZ_HOU02,0A3B0H INC H
10、Z_DAY02 ;日期加一 INC HZ_WEEK ;星期加一 RET TIM_NEXT_07: CMP HZ_HOU02,0A3BAH ;判断时的个位是否为十,是跳转JE TIM_NEXT_08 RET TIM_NEXT_08: INC HZ_HOU01 ;(个位为十)十位加一,个位置零MOV HZ_HOU02,0A3B0H RET FUCTION_00 ENDP FUCTION_01 PROC CALL CMP_MON CALL MON_COUNT CALL YEAR_WALK RET FUCTION_01 ENDP CMP_MON PROC CMP HZ_MON01,0A3B0H ;判断
11、是否是个位的月份 JE MON01_EQU_0 JMP MON01_EQU_1 MON01_EQU_0: CMP HZ_MON02,0A3B1H ;一月JE GO_TO_31 CMP HZ_MON02,0A3B2H ;二月 JE GO_TO_2MON CMP HZ_MON02,0A3B3H ;三月 JE GO_TO_31 CMP HZ_MON02,0A3B4H ;四月 JE GO_TO_30 CMP HZ_MON02,0A3B5H ;五月 JE GO_TO_31CMP HZ_MON02,0A3B6H ;六月 JE GO_TO_30 CMP HZ_MON02,0A3B7H ;七月 JE GO_T
12、O_31 CMP HZ_MON02,0A3B8H ;八月 JE GO_TO_31 CMP HZ_MON02,0A3B9H ;九月 JE GO_TO_30 MON01_EQU_1: CMP HZ_MON02,0A3B0H ;十月 JE GO_TO_31 CMP HZ_MON02,0A3B1H ;十一月 JE GO_TO_30 CMP HZ_MON02,0A3B2H ;十二月 JE GO_TO_31 GO_TO_31: CALL COUNT_31 ;31天的子程序JMP TO_END GO_TO_30: CALL COUNT_30 ;30天的子程序 JMP TO_END GO_TO_2MON: C
13、ALL MON_2_COUNT ;二月的子程序 JMP TO_END TO_END: RET CMP_MON ENDP COUNT_28 PROC CMP HZ_DAY01,0A3B2H ;判断天十位是否为2,是跳转 JE NEXT_28_01 JMP NEXT_28_03 NEXT_28_01: CMP HZ_DAY02,0A3B9H ;判断天个位是否为9,是跳转JE NEXT_28_02 JMP NEXT_28_03NEXT_28_02: MOV HZ_DAY01,0A3B0H MOV HZ_DAY02,0A3B1H INC HZ_MON02 ;月加一 NEXT_28_03: CMP HZ
14、_DAY02,0A3BAH JE NEXT_28_04RET NEXT_28_04: MOV HZ_DAY02,0A3B0H INC HZ_DAY01 RET COUNT_28 ENDP COUNT_29 PROC CMP HZ_DAY01,0A3B2H ;判断天十位是否为2,是跳转JE NEXT_29_01 JMP NEXT_29_03 NEXT_29_01: CMP HZ_DAY02,0A3BAH ;判断天个位是否为A,是跳转JE NEXT_29_02 JMP NEXT_29_03 NEXT_29_02: MOV HZ_DAY01,0A3B0H MOV HZ_DAY02,0A3B1H IN
15、C HZ_MON02 ;月加一NEXT_29_03: CMP HZ_DAY02,0A3BAH JE NEXT_29_04 RET NEXT_29_04: MOV HZ_DAY02,0A3B0H INC HZ_DAY01 RET COUNT_29 ENDP COUNT_30 PROC CMP HZ_DAY01,0A3B3H;判断天十位是否为3,是跳转JE NEXT_30_01 JMP NEXT_30_03 NEXT_30_01: CMP HZ_DAY02,0A3B1H ;判断天个位是否为1,是跳转JE NEXT_30_02 JMP NEXT_30_03 NEXT_30_02: MOV HZ_DA
16、Y01,0A3B0H MOV HZ_DAY02,0A3B1H INC HZ_MON02 ;月加一 NEXT_30_03: CMP HZ_DAY02,0A3BAH JE NEXT_30_04RET NEXT_30_04: MOV HZ_DAY02,0A3B0H INC HZ_DAY01 RET COUNT_30 ENDP COUNT_31 PROC CMP HZ_DAY01,0A3B3H ;判断天十位是否为3,是跳转 JE NEXT_31_01 JMP NEXT_31_03 NEXT_31_01: CMP HZ_DAY02,0A3B2H;判断天个位是否为2,是跳转 JE NEXT_31_02 J
17、MP NEXT_31_03 NEXT_31_02: MOV HZ_DAY01,0A3B0H ;置天数为01MOV HZ_DAY02,0A3B1H INC HZ_MON02 ;月份加一 RET NEXT_31_03: CMP HZ_DAY02,0A3BAH ;个位是否为十,是跳转 JE NEXT_31_04 RET NEXT_31_04: MOV HZ_DAY02,0A3B0H ;个位置零,十位加一 INC HZ_DAY01 RET COUNT_31 ENDP MON_2_COUNT PROC MOV AX, HZ_YEAR01 ;判断是否是闰年 AND AX,01H MOV CX,0AH MU
18、L CX MOV BX,HZ_YEAR02 AND BX,01H ADD AX,BX MOV DX,00H MOV BX,04H DIV BX CMP DX,0JE GO_TO_29 JMP GO_TO_28 GO_TO_29: CALL COUNT_29 ;29天的子程序 GO_TO_28: CALL COUNT_28 MON_2_COUNT ENDPYEAR_PANDUAN PROC MOV AX, HZ_YEAR01 MOV CX,0AH MUL CX ADD AX,HZ_YEAR02 MOV DX,00H MOV BX,04H DIV BX CMP DX,0 RET YEAR_PAND
19、UAN ENDPMON_COUNT PROC CMP HZ_MON01,0A3B1H ;判断月的十位是否为一 JE MON_NEXT_01 JMP MON_NEXT_03 MON_NEXT_01: CMP HZ_MON02,0A3B3H JE MON_NEXT_02 JMP MON_NEXT_03 MON_NEXT_02: MOV HZ_MON01,0A3B0H MOV HZ_MON02,0A3B1H INC HZ_YEAR02 RET MON_NEXT_03: CMP HZ_MON02,0A3BAH JE MON_NEXT_04 RETMON_NEXT_04: MOV HZ_MON02,0A
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 硬件 课程设计 日历 本科 论文
限制150内