资源描述:
《12分钟倒计时程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、LOADBITP1.2DINBITP1.0DCLKBITP1.1DOUTBITP3.3KEYEQU22H;存放按键键码KDEQU23H;存放按键号KEY_FBIT00H;有键标志位SECEQU25H;秒单元MINEQU26H;分单元ORG0000HAJMPMAINORG0100HMAIN:MOVSP,#60H;初始化MOVST,#0CLRKEY_FMOVKEY,#0MOVKD,#0MOVSEC,#0MOVMIN,#0MOVTMOD,#01H;定时器初始化MOVTH0,#0DBHMOVTL0,#0F9HMOVIE,#82HCH451_INIT
2、:;CH451初始化子程序MOVP1,#60HCLRDIN;先低后高SETBDCLK;置为默认的高电平SETBDIN;输出上升沿CH451选择4线串行接口SETBLOADSETBDOUT;置为输入NOPMOVB,#04H;设置CH451MOVA,#03H;关看门狗开显示键盘LCALLWRITENOPMOVB,#05H;设置显示模式为译码方式MOVA,#80HLCALLWRITENOPCLRIT1;置外部中断信号为低电平触发CLRIE1;清中断标志SETBEX1;允许键盘中断SETBEA;开总中断START:LCALLDISP;当前计时显示J
3、NBKEY_F,START;无按键等待CLRKEY_F;有按键,清按键标志DISP:;显示子程序PUSHPSWPUSHACCMOVB,#0FH;加载字数据7MOVA,SECANLA,#0FHACALLWRITEMOVA,SECSWAPAANLA,#0FHDECB;加载字数据6ACALLWRITEMOVA,#12HDECB;加载字数据5ACALLWRITEMOVA,MINANLA,#0FHDECB;加载字数据4ACALLWRITEMOVA,SWAPAANLA,#0FHDECB;加载字数据3ACALLWRITEMOVA,#10HDECB;加载字
4、数据2ACALLWRITEMOVA,MINANLA,#0FHDECB;加载字数据1ACALLWRITEMOVA,SWAPAANLA,#0FHDECB;加载字数据0ACALLWRITEPOPACCPOPPSWRETWRITE:PUSHPSWPUSHACCCLREX1CLRLOADMOVR7,#08HWRITE_8:RRCACLRDCLKMOVDIN,CSETBDCLKDJNZR7,WRITE_8MOVA,BMOVR7,#04HWRITE_4:RRCACLRDCLKMOVDIN,CSETBDCLKDJNZR7,WRITE_4SETBLOADSE
5、TBEX1POPACCPOPPSWRET