资源描述:
《学士学位论文—-硬件课程设计日历.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、2系统模块详细设计与调试1 在主程序中要分别对8254和8255初始化编程。具体如下:8254控制字: MOV DX,PORT_8253 MOV AL,00110101B ;写入控制字,0通道,方式2 OUT DX,AL MOV DX,PORT_0 MOV 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,AL MOV AL,10H OUT DX
2、,AL 8255控制字:MOV DX,PORT_8255 ;8255初始化 MOV AL,80H OUT DX,AL程序清单与注释:PORT_AEQU288HPORT_BEQU289HPORT_CEQU28AHPORT_8255EQU28BHPORT_0EQU280HPORT_1EQU281HPORT_2EQU282HPORT_8253EQU283HDATASEGMENT;01234567TABLE1DB77H,7BH,7DH,7EH,0B7H,0BBH,0BDH,0BEH;89ABCDEFDB0D7H,0DBH,0DDH,0DEH,0E7H,0EBH,0EDH,
3、0EEHHZ_SEC02DW0A3B0HHZ_SEC01DW0A3B0HHZ_MIN02DW0A3B0HHZ_MIN01DW0A3B0HHZ_HOU02DW0A3B0HHZ_HOU01DW0A3B0HHZ_TIMDW0A1C3H;符号":"HZ_SYMDW0A1C3HHZ_YEAR02DW0A3B0HHZ_YEAR01DW0A3B0HHZ_MON02DW0A3B1HHZ_MON01DW0A3B0HHZ_DAY02DW0A3B1HHZ_DAY01DW0A3B0HHZ_DATEDW0A3AFHHZ_WEEKDW0A3B6HHZ_WEEK01DW0D0C7H;字体"星"HZ
4、_WEEK02DW0C6DAH;字体"期"HZ_XDW0A1EFH;符号"★"HZ_WDW0CDF2H;字体"万"HZ_NDW0C4EAH;字体"年"HZ_RDW0C8D5H;字体"日"HZ_LDW0C0FAH;字体"历"HZ_ADRDB?DATAENDSSTACK1SEGMENTSTACKDW50DUP(0)TOP_STACLABELWORDSTACK1ENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,STACK1MOVSS,AXLEASP,TOP_STACMOVAX,DATAMOVDS,AXMOVDX,PORT_825
5、5;8255初始化MOVAL,80HOUTDX,ALCALLCLEAR;LCD清除CALLFUCTION_A;日期显示;8253的编程MOVDX,PORT_8253MOVAL,00110101B;写入控制字,0通道,方式2OUTDX,ALMOVDX,PORT_0MOVAL,00HOUTDX,ALMOVAL,10HOUTDX,ALMOVDX,PORT_8253MOVAL,01110111B;1通道,方式3OUTDX,ALMOVDX,PORT_1MOVAL,00HOUTDX,ALMOVAL,10HOUTDX,ALMAIN:LP:MOVDX,PORT_CTESTDX,10H
6、;检测B口是否有1秒脉冲JNZLPTESTDX,00HJNZLPINCHZ_SEC02;秒的个位加一;判断是否有键按下MOVDX,PORT_8255MOVAL,10001010B;A口输出B口输入C口低四位输出,高四位输入OUTDX,ALMOVDX,PORT_A;A口为行,向所有的行输出0MOVAL,00HOUTDX,ALMOVDX,PORT_BRET_TO_1:MOVAL,0FEHMOVCL,ALNEXT_ROW_1:MOVDX,PORT_AOUTDX,ALMOVDX,PORT_BINAL,DXANDAL,0FHCMPAL,0FH;判断是否有键按下JNEJP_1CM
7、PCL,0EFHJEFUCROLCL,01MOVAL,CLJMPNEXT_ROW_1JP_1:CALLJPFUC:CALLFUCTION_00;时间的进位CALLFUCTION_01;日期的进位CALLFUCTION_02;星期的进位CALLFUCTION_A;日期显示JMPMAINFUCTION_00PROCCMPHZ_SEC02,0A3BAH;判断是否为十,是跳转到秒进位子程序JETIM_NEXT_01RETTIM_NEXT_01:INCHZ_SEC01;秒的十位加一MOVHZ_SEC02,0A3B0H;个位置零CMPHZ_SEC01,0A3B6