资源描述:
《汇编与接口键盘显示实验报告》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《微机原理与接口技术》上机实验报告学院(部)专业班级学生姓名学号实验六键盘扫描及显示设计实验一、实验目的1.学习按键扫描的原理及电路接法;2.掌握利用8255完成按键扫描及显示。二、实验内容1.按原理图1连接好电路。2.编程:编程使得在键盘阵列上每按一个键后,微机屏幕和最右端的数码管上有相应字符显示出来,按“E”退出程序。3.实验提不(1)8255CS接地址译码输出的288h-28fho(2)8255的A口PA0~PA7接数码管的a〜dp。数码管位码SO接+5V,S3~S1接GND。(3)延时程序可用BIOS功能程序INT1AH的0号
2、功能程序:其出口参数:CH:CL二时:分;DH:DL二秒:1/100秒。+5V288~287MMcs5g5u828esVCC•…80亠pft-.s::亠十手玉Od234567AAAAAAAApppppblpp01234567BBBBBBBBpppppPPAP01234567ccccccccpppppppp图1键盘显示连接图三、程序流程入口键盘扫描子程序涼程图主程序潦程图’四.程序代码datasegmentstringdbtheinitializationisokay$ ah,0dhkeydb0e7h,Oebh,Oedh,Oeeh,0
3、d7h,Odbh,Oddh,Odeh,Ob7h,Obbh,Obdh,Obeh,77h,7bh,7dh,7eharraydb33h,37h,66,70,32h,36h,65,69,31h,35h,39h,6&30h,34h,38h,67numdb16overdb?dataendsstack1segmentstack'stack'dw50dup(?)stack1endscodesegmentassumecs:code,ds:data,ss:stacklstart:movax,datamovds,axmovax.segstring;显示提示
4、movds,axmovdx,offsetstringmovah,09hint21h.while1callexam.ifover==69movah,4chint21h.endif.endwmovah,4chlllllllllllllllllllllint21hexamproc;检测子程序//////////////////moval,81h;设置8255工作方式字movdx,28bhoutdx,allpl:moval,OOh;向C端口高四位输出低电平movdx,28ahoutdx,alinal,dx;C端口低四位cmpal,Ofhjz
5、lplcalldelay;延时子程序movbl,al;保存列值moval,88h;重置8255工作方式字movdx,28bhoutdx,almoval,blmovdx,28ahoutdx,alinal,dx;读入行值movah,blmovcl,4rcrax,cl.ifal==0b7h;1movover,31hmoval,31hmovdl,almovah,2hint21hmoval906hmovdx,288houtdx,al.endif.ifal==0d7h;2movover,32hmoval,32hmovdl,almovah,2hin
6、t21hmoval,O5bhmovdx,288houtdx,al.endif.ifal==0e7h;3movover,33hmoval,33hmovdl,almovah,2hint21hmoval,4fhmovdx,288houtdx,al.endifmovah,2hint21hmoval,66hmovdx,288houtdx,al.endif.ifal==Obbh;5movover,35hmoval,35hmovdl,almovah,2hint21hmoval96dhmovdx,288houtdx,al.endif.ifal==Od
7、bh;6movover,36hmoval,36hmovdl,almovah,2hint21hmovaljdhmovdx,288houtdx,al.endif.ifal==Oebh;7movover,37hmoval,37hmovdl,almovah,2hint21hmovaI507hmovdx,288houtdx,al.endifmovah,2hint21hmoval,7fhmovdx,288houtdx,al.endifjfal==Obdh;9movover,39hmoval,39hmovdl,almovah,2hint21hmov
8、al967hmovdx,288houtdx,al.endif.ifal==Oddh;amovover,65moval,65movdl,almovah,2hint21hmoval,77hmovdx,288houtdx,al