您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 接口课程设计_实现特定功能的键盘及LED显示
实现特定功能的键盘及LED显示了解键盘及LED显示接口原理,设计实验电路图完成以下功能:1.按1键显示年;2.按2键显示月日;3.按3键显示GOOD;4.按4键数码管由左到右字符“0”循环显示。5.自行设计特效显示功能。CODESEGMENTASSUMECS:CODE,DS:CODESTART:MOVAX,CSMOVDS,AXINPUT:CALLKEYBOARDLEASI,KEYBUFFER;取按键的值MOVAL,[SI]CMPAL,1JNZL0JMPSHOW_YEAR;显示年L0:CMPAL,2JNZL1JMPSHOW_MD;显示月日L1:CMPAL,3JNZL2JMPSHOW_GOOD;显示GOODL2:CMPAL,4JNZL3JMPSHOW_0;由左到右字符“0”循环显示L3:CMPAL,7JNZL4JMPSHOW_SUN;显示SUNL4:JMPSHOW_HERO;显示HERO;----------------------------------结束---------------------------------------------;--------------------------------显示年开始----------------------------------------SHOW_YEAR:MOVCH,01111111B;初始化位选码01111111BMOVBH,11110111B;显示位选结束位LEASI,YEARBUFFERCALLDISPLAYDECCOUNT;重复显示COUNT次JNZSHOW_YEARMOVCOUNT,250JMPINPUT;--------------------------------------结束-------------------------------------------;-----------------------------------显示月开始---------------------------------------SHOW_MD:MOVCH,01111111B;初始化位选码01111111BMOVBH,11110111B;显示位选结束位LEASI,MDBUFFERCALLDISPLAYDECCOUNT;重复显示COUNT次JNZSHOW_MDMOVCOUNT,250JMPINPUT;---------------------------------结束--------------------------------------------------;---------------------------------显示GOOD-----------------------------------------------SHOW_GOOD:MOVCH,01111111B;初始化位选码01111111BMOVBH,11110111B;显示位选结束位LEASI,GOODBUFFERCALLDISPLAYDECCOUNT;重复显示COUNT次JNZSHOW_GOODMOVCOUNT,250JMPINPUT;----------------------------------结束--------------------------------------------------;---------------------------------显示HERO-----------------------------------------------SHOW_HERO:DE:MOVCH,01111111B;初始化位选码01111111BLEASI,HEROBUFFERMOVBH,11110111B;显示位选结束位CALLDISPLAYDECCOUNT;重复显示COUNT次JNZSHOW_HEROMOVCOUNT,10DECXUNMOVCOUNT,10CALLSHOWDELAY_HCMPXUN,00H;闪光显示JNZDEMOVXUN,15MOVCOUNT,250JMPINPUT;----------------------------------结束-------------------------------------------------;---------------------------显示由左到右字符“0”循环------------------------------------SHOW_0:MOVBX,3LSHOW0:MOVCH,01111111B;初始化位选码01111111LEADI,LINBUFFERMOVAL,80HMOVDX,203HOUTDX,AL;再次初始化8255DISPLAY_0:MOVAL,CHMOVDX,202HOUTDX,AL;位选码送PC口MOVAL,[DI]MOVDX,200H;MOVAL,5BHOUTDX,AL;显示段码CALLSHOWDELAY0RORCH,1;指向下一个数码管CMPCH,11110111BJNZDISPLAY_0DECBX;重复显示3次JNZLSHOW0JMPINPUT;----------------------------------结束-------------------------------------------------;-----------------------------显示SUN-------------------------------------------SHOW_SUN:MOVCH,01111111B;初始化位选码01111111BMOVBH,11101111B;显示位选结束位LEASI,SUNBUFFERCALLDISPLAYDECCOUNT;重复显示COUNT次JNZSHOW_SUNMOVCOUNT,250JMPINPUT;-----------------------------------结束------------------------------------------------;----------------------------------显示延时-----------------------------------------------SHOWDELAYPROCNEARPUSHBXPUSHCXMOVBX,10SHOWDEL1:MOVCX,100SHOWDEL2:LOOPSHOWDEL2DECBXJNZSHOWDEL1POPCXPOPBXRETSHOWDELAYENDP;-----------------------------------结束-----------------------------------------------;----------------------------------显示延时0--------------------------------------------SHOWDELAY0PROCNEARPUSHBXPUSHCXMOVBX,100SHOW0DEL1:MOVCX,2000SHOW0DEL2:LOOPSHOW0DEL2DECBXJNZSHOW0DEL1POPCXPOPBXRETSHOWDELAY0ENDP;-----------------------------------结束---------------------------------------------SHOWDELAY_HPROCNEARPUSHBXPUSHCXMOVBX,10SHOW_HDEL1:MOVCX,2000SHOW_HDEL2:LOOPSHOW_HDEL2DECBXJNZSHOW_HDEL1POPCXPOPBXRETSHOWDELAY_HENDP;---------------------------------显示程序------------------------------------------DISPLAYPROCNEARMOVAL,80HMOVDX,203HOUTDX,AL;再次初始化8255DISPLAY1:MOVAL,CHMOVDX,202HOUTDX,AL;位选码送PC口MOVAL,[SI]MOVDX,200HOUTDX,AL;显示段码CALLSHOWDELAY;延时INCSIRORCH,1;指向下一个数码管CMPCH,BHJNZDISPLAY1RETDISPLAYENDP;-----------------------------------结束---------------------------------------------;---------------------------------读取按键盘------------------------------------------KEYBOARDPROCNEARLEASI,KEYBUFFERMOVAL,10000001B;初始化8255控制字MOVDX,203HOUTDX,ALKS1:CALLKS;读取按键CMPAL,0FH;判断有无按键JZKS1CALLDELAYCALLKSCMPAL,0FHJZKS1MOVBL,0EFH;初始化列码MOVBH,0;初始化列计数器AGAIN:MOVDX,202HMOVAL,BLOUTDX,AL;输出列码INAL,DX;读取行码ANDAL,0FHCMPAL,0FHJZNEXT;该列无键闭合,准备下一列扫描CMPAL,0DH;判断列是否是第一个键闭合?JNZTWOMOVAL,1JMPFREETWO:;判断列是否是第二个键闭合?CMPAL,0BHJNZTHREEMOVAL,4JMPFREETHREE:;判断列是否是第三个键闭合?CMPAL,07HJNZNEXTMOVAL,7FREE:PUSHAXWAIT1:CALLKSCMPAL,0FHJNZWAIT1POPAXADDAL,BHMOV[SI],AL;保存键值,并返回JMPRETURNNEXT:INCBHROLBL,1CMPBL,0FEHJNZAGAINJMPKS1KSPROCNEARMOVDX,202HMOVAL,0FHOUTDX,ALINAL,DXANDAL,0FHRETKSENDPDELAYPROCNEARPUSHBXPUSHCXMOVBX,2000DEL1:MOVCX,10DEL2:LOOPDEL2DECBXJNZDEL1POPCXPOPBXRETDELAYENDPRETURN:RETKEYBOARDENDPEXIT:MOVAH,4CHINT21HXUNDB15YEARBUFFERDB5BH,3FH,3FH,6FH;存放年2009MDBUFFERDB3FH,6FH,3FH,66H;存放月日0904GOODBUFFERDB6FH,5CH,5CH,5EH;GOODKEYBUFFERDB1LINBUFFERDB3FHHEROBUFFERDB76H,79H,77H,3FH;HEROSUNBUFFERDB6DH,3EH,37H;SUNCOUNTDB250;显示次数----------------------------------结束-----------------------------------------CODEENDSENDSTART
本文标题:接口课程设计_实现特定功能的键盘及LED显示
链接地址:https://www.777doc.com/doc-3338965 .html