微机接口自考北大上机题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

用8255,从A口输入一个8位的数,高4位置一,低4位取反,从C口输出。8255地址,A:288H、C:28AH、控制:28BH。CODESEGMENTASSUMECS:CODESTART:MOVDX,28BH;8255初始化设置MOVAL,92HOUTDX,ALLLL:MOVDX,288HINAL,DX;从A口输入XORAL,0FH;低4位取反ORAL,0F0H;高4位置一MOVDX,28AHOUTDX,AL;C口输出MOVAH,0*H;功能好象是按任意键退出,记不清楚了INT16HJZLLLMOVAH,4CHINT21HCODEENDSENDSTART8255的A口交替输出AAh和55h,时间间隔为1秒。当8253方式0输入三个单脉冲事终止。8253为通道1.9月11号上午的考题8253性质通道1方式0,手动输入单脉冲,out1给8255的pa0,8255a口输入c口输出给8个指示灯。当pa0=0的时候指示灯每隔一个亮,且间隔一秒当pa0=1的时候指示灯每隔两个亮,且间隔一秒9月10日下午考题8253通道1方式0,记数初值3,out1输出到pa0口,8255方式0,a口输入,c口输出到LED灯上,当PA0=0时,01010101-10101010循环,当PA0=1时,00110011-11001100循环,有键按下返回DOS.9月6日上午题8255Ac口低四位输入,a口输出到数码段,当pc0=0时,a口输出是加一循环(0~f),pc0=1时,a口输出是减一循环(f~0),输出时延一秒钟,有键按下就退出……datasegmentleddb71h,79h,3fh,39h,7fh,77h,67h,7fhdb07h,7ch,6dh,6eh,4fh,5bh,06h,3fhcountdb0(定义循环初始值为零)dataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axmovdx,28bhmoval,81houtdx,al(8255初始化)input:movdx,28ahinal,dxandal,0fhandal,01h(判断pc0)jza1moval,countandal,0fh(要屏蔽高四位,以免超过15后出乱码)leabx,ledxlatmovdx,288houtdx,alcalldelay(延迟子程序老师会给出)deccountmovah,1int16hjzinput(判断是否有键按下,无则继续判断pc0)jmpa2(有则返回dos)a1:moval,countandal,0fhleabx,ledxlatmovdx,288houtdx,alcalldelayinccountmovah,1int16hjzinputa2:movah,4chint21hdelayprocnear....delayendpcodeendsendstart9月8日接口上午题8253方式0,通道1,计数初值来自8255A口低四位,将计数结果从8255C口显示至七段数码管,并从8255A口高四位输出到指示灯高四位,键盘有键按下返回DOS,否则继续执行。9月7号下午考题8253clk0输入1MHZ脉冲,OUT1输出1HZ到8255C囗,若PC0=1,则PA囗输出11001100,若PC0=0,则PA囗输出00110011.不难吧!我二十分钟就搞定了。答案太长了,我给出一部分吧。初始化部分l1:movdx,281hinal,dxmovdx,28ahoutdx,almovdx,28ahinal,dxtestal,01jzl2movdx,288hmoval,cchoutdx,aljmpl3l2:movdx,288hmoval,33houtdx,all3:movah.01hint16hjzl1movah,4chint21h9月7日上午考题8255方式0,从C口输入一个数最大值为0FFH,再检测C0输入的数据,如为1,则+1,从A口输出,如为0,则—1从A口输出,延时一秒,有键按下则退出codesegmentassumecs:codestart:moval,89hmovdx,28bhoutdx,almovdx,28ahinal,dxmovbl,almovcl,all:movdx,28ahinal,dxtestal,1jzaincblmoval,bljmpba:decclmoval,clb:movdx,288houtdx.almovah,16hint21hjzlmovah,4chint21hdelayprocnear...dalayendpcodeendsendstart8253通道1,方式0,8255C口高四位输入,A口输出到数码管。8253计数器初值为8255C口高四位输入的数值。8255A口输出值为8253计数器的当前值。(题意也就是例如;C口高四位输入5,按一下单脉冲,数码管显示4,再按一下数码管显示3……)10.8253通道0方式0,计数值为0Fh,手动逐个输入脉冲,从计算机显示器上显示对应的数。codesegmentassumecs:codestart:movdx,283hmoval,10houtdx,almovdx,280hmoval,0fhoutdx,all1:movdx,280hinal,dxcalldispmovah,1int16hjzl1movah,4chint21hdispprocnearpushdxandal,0fhmovdl,alcmpdl,9jbenumadddl,7num:adddl,30hmovah,02hint21hmovdl,0dhint21hmovdl,0ahint21hpopdxretdispendpcodeendsendstart11.8253通道0方式0,从8255C口读入计数值,手动逐个输入脉冲,从A口输出在数码管显示其值。codesegmentassumecs:codestart:movdx,28bhmoval,88houtdx,almovdx,28ahinal,dxmovcl,4shral,clandal,0fhmovbl,almovdx,283hmoval,10houtdx,almoval,blmovdx,280houtdx,all1:movdx,280hinal,dxmovdx,288houtdx,almovah,1int16hjzl1movah,4chint21hcodeendsendstart12.8253通道1方式1(硬件可重触发),计数值0Fh,用8255A口输出在数码管显示值,有键按下返回DOS,无键按下继续执行。datasegmentleddb3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71hdataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axleabx,ledmovdx,28bhmoval,80houtdx,almovdx,283hmoval,52houtdx,almoval,0fhmovdx,281houtdx,all1:movdx,281hinal,dxxlatmovdx,288houtdx,alpushdxmovah,06hmovdl,0ffhint21hpopdxjzl1movah,4chint21hcodeendsendstart13.8253通道1方式0,计数值为0Fh,手动逐个输入脉冲,用8255C口输出在数码管显示其值,并在计算机显示器显示,但计算机上显示顺序为0~F递增。datasegmentleddb3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71hdataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axleabx,ledmovdx,28bhmoval,80houtdx,almovdx,283hmoval,50houtdx,almoval,0fhmovdx,281houtdx,all2:movdx,281hinal,dxcalldispxlatmovdx,28ahoutdx,almovah,1int16hjzl2movah,4chint21hdispprocnearpushdxpushaxmovcl,0fhsubcl,almoval,clcmpal,0ahjbd1addal,07hd1:addal,30hmovdl,almovah,02hint21hmovdl,0dhint21hmovdl,0ahint21hpopaxpopdxretdispendpcodeendsendstart题目:把一个1mhz的脉冲通过两次分频转换成1hz的方波。(通道0、通道1、通道2、控制字地址分别为280h,281h,282h,283h)答案:codesegmentassumecs:codestart:movdx,283houtdx,00110111b;选中通道0,工作在3方式下,对bcd码自减movdx,280hmoval,0houtdx,almoval,10houtdx,almovdx,283houtdx,01110111b;选中通道1,工作在3方式下,对bcd码自减movdx,281hmoval,0houtdx,almoval,10houtdx,alcodesegmentendstart注:连线:clk0-1mhzgate0-1out0-clk1gate1-1out1-逻辑笔题目:A口输入,C口输出。如果A口最高位A7输入是0则指示灯L5,L2亮,如果A口最高位A7输入是1,则指示灯L7,L0亮,实际上就是对应C口的C5,C2,C7,C0是高电平还是低电平。参考答案:codesegmentassumecs:codestart:movdx,28bhmoval,90houtdx,al;设定为a口输入c口输出movdx,28ahmoval,24houtdx,al;设定初始状态为A7等于0,此时L5,L2亮input:movdx,288hinal,dx;读入A口状态cmpal,81hjzinput;如果A7是0就跳转接着读入moval,81hmovdx,28ah;如果A7是1就向C口输出指示灯L7,L0亮的数据outdx,almovah,4chint21hcodeendsendstart9月11号上午的考题8253性质通道1方式0,手动输入单脉冲,out1给8255的pa0,8255a口输入c口输出给8个指示灯。当pa0=0的时候指示灯每隔一个亮,且间隔一秒当pa0=1的时候指示灯每隔两个亮,且间隔一秒9月10日下午考题8253通道1方式0,记数初值3,out1输出到pa0口,8255方式0,a口输入,c口输出到LED灯上,当PA0=0时,01010101-10101010循环,当PA0=1时,00110011-11001100循环,有键按下返回DOS.9月6日上午题8255Ac口低四位输入,a口输出到数码段,当pc0=0时,a口输出是加一循环(0~f),pc0=1时,a口输出是减一循环(f~0),输出时延一秒钟,有键按下就退出...datasegmentleddb71h,79h,3fh,39h,7fh,77h,67h,7fhdb07h,7ch,6dh,6eh,4fh,5bh,06h,3fhcountdb0(定义循环初始值为零)dataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axmovdx,28bhmoval,81houtdx,al(8255初始化)input:movdx,28ahinal,dxandal,0fhandal,01h(判断pc0)jza1moval,countandal,0fh(要屏蔽高四位,以免超过15后出乱码)leabx,ledx

1 / 47
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功