微机原理.docx
- 文档编号:26660848
- 上传时间:2023-06-21
- 格式:DOCX
- 页数:12
- 大小:33.28KB
微机原理.docx
《微机原理.docx》由会员分享,可在线阅读,更多相关《微机原理.docx(12页珍藏版)》请在冰豆网上搜索。
微机原理
课程:
微机原理与接口技术设计
一、设计题目及要求:
【课题3】 利用8259A 的IRQ4 显示中断过程
设计要求:
1.主程序是在七段数码管上从左到右循环显示“2015”。
2.通过8259A 的IRQ4 引脚上的中断请求进入中断服务程序:
⑴ 若第一次进入中断,6个数码管全部显示“1”,同时LED显示灯中第一个灯闪烁;
⑵ 若第二次进入中断,6个数码管全部显示“2”,同时LED显示灯中前两个灯闪烁;
......;
⑹ 若第六次进入中断,6个数码管全部显示“6”,同时LED显示灯的前六个灯闪烁;
⑺ 若第七次进入中断,数码管显示“1 LOOP”,同时 LED 显示灯的所有红灯闪烁。
此后若再有中断进入,从⑴开始下一轮循环。
三、功能流程图:
开始开始
关中断关中断
初始化显示缓冲区8259判断中断次数
开中断显示1个灯显示2个灯。
。
。
1loop亮全灯
循环显示2015中断返回
附录:
实验代码:
(完整的源程序)
CODESEGMENT
ASSUMECS:
CODE,DS:
CODE,ES:
CODE
ORG3400H
H8:
JMPP8259
ZXKEQU0FFDCH
ZWKEQU0FFDDH
PAEQU0FFD8H
PBEQU0FFD9H
PCEQU0FFDAH
PCTLEQU0FFDBH
LEDDB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,0DEH,0F3H,0C7H,8CH
BUFDB?
?
?
?
?
?
Port0EQU0FFE0H
Port1EQU0FFE1H
P8259:
H3:
MOVAL,88H
MOVDX,PCTL
OUTDX,AL
WP:
MOVAX,OFFSETINT8259
MOVBX,0030H
MOV[BX],AX
MOVBX,0032H
MOVAX,0000H
MOV[BX],AX
CALLFOR8259
movsi,0000h
STI
MOVBUF,02H;初始化显示2015
MOVBUF+1,00H
MOVBUF+2,01H
MOVBUF+3,05H
MOVBUF+4,10H
MOVBUF+5,10H
CALLSC
MOVBUF,10H;
MOVBUF+1,02H
MOVBUF+2,00H
MOVBUF+3,01H
MOVBUF+4,05H
MOVBUF+5,10H
CALLSC
MOVBUF,10H
MOVBUF+1,10H
MOVBUF+2,02H
MOVBUF+3,00H
MOVBUF+4,01H
MOVBUF+5,05H
CALLSC
MOVBUF,05H
MOVBUF+1,10H
MOVBUF+2,10H
MOVBUF+3,02H
MOVBUF+4,00H
MOVBUF+5,01H
CALLSC
MOVBUF,01H
MOVBUF+1,05H
MOVBUF+2,10H
MOVBUF+3,10H
MOVBUF+4,02H
MOVBUF+5,00H
CALLSC
MOVBUF,00H
MOVBUF+1,01H
MOVBUF+2,05H
MOVBUF+3,10H
MOVBUF+4,10H
MOVBUF+5,02H
CALLSC
JMPWP
SC:
MOVBP,80H
CON8:
CALLDIS
DECBP
CMPBP,00H
JNZCON8
W1:
MOVBX,05H
WH:
DECBX
PUSHCX
MOVCX,0FFFFH
LOOP$
POPCX
CMPBX,00H
JNZWH
RET
;----------------------------------
INT8259:
cli
MOVDI,0000H
MOVBX,OFFSETBUF
INCSI
WC:
MOV[BX+DI],SI
INCDI
CMPDI,06H
JNZWC
XX59:
MOVAL,20H
MOVDX,Port0
OUTDX,AL
movcx,0010h
xxx59:
pushcx
CMPSI,0001H
JNZP2
CALLT1
P2:
CMPSI,0002H
JNZP3
CALLT2
P3:
CMPSI,0003H
JNZP4
CALLT3
P4:
CMPSI,0004H
JNZP5
CALLT4
P5:
CMPSI,0005H
JNZP6
CALLT5
P6:
CMPSI,0006H
JNZP7
CALLT6
P7:
CMPSI,0007H
JNZS3
CALLT7
POPCX
CMPCX,01H
JNZG1
MOVSI,0000H
G1:
CALLWS
PUSHCX
S3:
MOVCX,20H
S1:
PUSHCX
CALLDIS
POPCX
LOOPS1
MOVDX,PB
MOVAL,0FFH
OUTDX,AL
MOVDX,PA
MOVAL,0FFH
OUTDX,AL
MOVCX,20H
S2:
PUSHCX
CALLDIS
POPCX
LOOPS2
popcx
DECCX
CMPCX,00H
JNZxxx59
popcx
movcx,3505h
pushcx
STI
IRET
;==============================
FOR8259:
MOVAL,13H
MOVDX,Port0
OUTDX,AL
MOVAL,08H
MOVDX,Port1
OUTDX,AL
MOVAL,09H
OUTDX,AL
MOVAL,0EFH;IRQ4
OUTDX,AL
RET
;---------------------------
WS:
MOVBUF,01H;显示1loop
MOVBUF+1,10H
MOVBUF+2,14H
MOVBUF+3,00H
MOVBUF+4,00H
MOVBUF+5,15H
RET
T1:
MOVDX,PB
MOVAL,0F7H
OUTDX,AL
MOVDX,PA
MOVAL,0FFH
OUTDX,AL
RET
T2:
MOVDX,PB
MOVAL,0F3H
OUTDX,AL
MOVDX,PA
MOVAL,0FFH
OUTDX,AL
RET
T3:
MOVDX,PB
MOVAL,0F1H
OUTDX,AL
MOVDX,PA
MOVAL,0FFH
OUTDX,AL
RET
T4:
MOVDX,PB
MOVAL,0F0H
OUTDX,AL
MOVDX,PA
MOVAL,0FFH
OUTDX,AL
RET
T5:
MOVDX,PA
MOVAL,7FH
OUTDX,AL
INCDX
MOVAL,0F0H
OUTDX,AL
RET
T6:
MOVDX,PA
MOVAL,3FH
OUTDX,AL
INCDX
MOVAL,00H
OUTDX,AL
RET
T7:
MOVDX,PA
MOVAL,0B6H
OUTDX,AL
INCDX
MOVAL,0DH
OUTDX,AL
RET
;--------------------------------
DIS:
MOVCL,20H
MOVBX,OFFSETBUF
DIS1:
MOVAL,[BX]
PUSHBX
MOVBX,OFFSETLED
XLAT
POPBX
MOVDX,ZXK
OUTDX,AL
MOVAL,CL
MOVDX,ZWK
OUTDX,AL
PUSHCX
MOVCX,0100H
DELAY:
LOOP$
POPCX
CMPCL,01H
JZEXIT
INCBX
SHRCL,1
JMPDIS1
EXIT:
MOVAL,00H
MOVDX,ZWK
OUTDX,AL
RET
;--------------------------
CODEENDS
ENDH8
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 原理