资源描述:
《矩阵按键控制的电子时钟程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、源程疗::FKEYEQU20H.0SHIEQU50HFENEQU51HMIAOEQU52HCOUNTEREQU4AHTEMPEQU30HKEY_NOEQU21HTEMP_NUMEQU22HORG0000HLJMPMAINORG000BHLJMPINTTOORG01OOHMAIN:MOVSP,#60HMOVCOUNTER,#。。MOVSHI,#00MOVFEN,#00MOVMIAO,#00LCALLDISPLCALLKEY_SCAN;若有按键就等待按键放开,无则继续扫描显示器和键盘JBFKEY,WAIT_OFF0AJMPMAIN
2、WAIT_OFF0:ACALLDISPACALLKEY_SCANJBFKEY,WAIT_OFF0MOVR5,#5涎时1ms,清抖作用;按键松开后;按键松开后ACALLDELAYWAIT0:MOVA,KEY_NOCJNEA,#0AH,MAINSETBEASETBETOMOVTMOD,#01HMOVTLO,#OBOHMOVTH0,#3CHSETBTROSCAN:CLRKEY_NOCLRFKEYSCANO:LCALLDISPACALLKEY_SCANSCAN1:JBFKEY,WAIT_OFFAJMPSCANWA1T_OFF:ACAL
3、LDISPACALLKEY_SCANJBFKEY,WAIT_OFFMOVR5,#5ACALLDELAYWAIT:MOVA,KEY_NO;调用扫描子程序;调用扫描子程序;若有按键就等待按键放开,无则继续打描显示器和键盘;延时1ms,清抖作用;按键松开后;按键松开后NEXT:CJNEA,#0AH,NEXT0ACALLSTOPNEXTO:CJNEA,#OBH,NEXT1ACALLTIAOSHI;键值判断,分支跳转;停止NEXT1:CJNEA,#0CH,NEXT2ACALLTIAOFENNEXT2:CJNEA,#()DH,NEXT3A
4、CALLTIAOMIAONEXT3:CJNEA,#0EH,NEXT4ACALLSTOPNEXT4:CJNEA,#0FH,NEXT5ACALLSTOPNEXT5:AJMPSCAN・******************************************STOP:AJMPMAINRET键盘****************************wwwwwwww■rj^rj^r
5、^rj^r
6、^rj*rj*rj*rj*rj*rj*rj^rj*KEY_SCAN:MOVR3,#0EFHMOVR4,#0MOVR1,#4CLRPS
7、W.5;加载扫描输出初始信号11101111BS1:MOVA,R3MOVPl,AMOVR5,#lACALLDELAYMOVA,PlANLA,#0FHMOVR2,#4;循环扫描16个按键;读取P1口数据判断按键是否有效S2:JBACCAN1MOVKEY_NO,R4SETBPSW.5;判断有无按键,若为1则表示没按键按下N1:INCR4RRADJNZR2,S2MOVA,R3RLAMOVR3,ADJNZRLSIBACK:JNBPSW.5,NO_KEYSETBFKEYRETNO_KEY:CLRFKEYRET^2z•rYwrTwrTwr
8、TwrY*rYwrTwrTweTwrTwrTwrTwrT*rYwrYwrTwrTwrTwrYwrTwrYwrTwrYwrTwrYwrTwrYwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTwrTweTw;对一行进行扫描;移至下一行扫描*&»•土*&»•土*&»•土*&»•土*&»•土*&»•丄■*&••丄■*&»•丄■•丄*•
9、丄■*1#•丄**1#•丄■*1#•丄■*1#*1#•丄■*1#•士*1#•士*1#•士*1#•士*1#•士•**宣*容*容*容*容*宣*容*宣*宕***容*^*:i:WWWWWWHUAN:MOVA,SHIMOVB,#10DIVABMOVTEMP,AMOVTEMP+1,BMOVTEMP+5,#10MOVA,FENMOVB,#10DIVABMOVTEMP+3,AMOVTEMP+4,BMOVTEMP+2,#10MOVA,MIAOMOVB,#10DIVABMOVTEMP+6,AMOVTEMP+7,BRET•上•上•上•上n*
10、■“•
11、怜6怜6怜6怜6怜6怜6怜6怜6怜6怜6怜6个6个6个6个6个6个6忖十-fj4^IJIripT—介•[:!—TIAOSHI:CLREACLRFKEYMOVA,#()0HMOVKEY_NO,AMO:LCALLKEY_SCANLCALLDISPJBFKEY,WAIT_OFF1A