补充资料05-基于Protues的仿真实例-8259A中断管理芯片的应用

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

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

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

资源描述

8259A中断管理芯片应用实例实例1:利用一个按钮控制8个发光二极管的循环点亮。原理图:源程序:OUT_LEDEQU0160HCODESEGMENTPUBLIC'CODE'ASSUMECS:CODESTART:XORAX,AXMOVDS,AXMOVSI,2*4MOV[SI],OFFSETNMI_SERVICE3MOV[SI+2],SEGNMI_SERVICE3MOVAL,07FHMOVDX,OUT_LEDOUTDX,ALMOVBL,0JMP$NMI_SERVICE1PROCRORAL,1MOVDX,OUT_LEDAA:OUTDX,AL;显示EXIT:IRETNMI_SERVICE1ENDPNMI_SERVICE2PROCMOVAL,7FHMOVDX,OUT_LEDAA2:OUTDX,ALCALLD1SRORAL,1JMPAA2IRETNMI_SERVICE2ENDPD1SPROCMOVCX,520LP1:NOPLOOPLP1RETD1SENDPNMI_SERVICE3PROCMOVAL,7FHMOVDX,OUT_LEDNOTBLCMPBL,0AA3:JZBB3OUTDX,AL;显示CALLD1SRORAL,1JMPAA2BB3:MOVAX,0FFHOUTDX,AL;显示JMP$IRETNMI_SERVICE3ENDPCODEENDSENDSTARTAD0AD1AD2AD3AD4AD5AD6AD7AD8AD9AD10AD11AD12AD13AD14AD15A0A1A2A3A4A5A6A7A8A9A10A11A12A13A14A15AD16AD17AD18AD19A19A18A17A16A15A14A11A10A9A4A4A13A12A7A15A14A13A12A11A10A9A7A15A4A6A8A12A6A5A9A5A7A8A10A11A13A14D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U674273D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U774273U8NOTAD[0..15]ADR[0..19]RDWRAD[16..19]AD[16..19]D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U1074273BHEAD[0..15]READY22INTR18NMI17RESET21CLK19MN/MX33HOLD/GT131HLDA/GT030A[16..19]M/IO/S028ALE/QS025DT/R/S127INTA/QS124TEST23BHE34DEN/S226RD32WR/LOCK29U18086LOAD_SEG=0x0800M/IONMI12345671011121314159U1574S133+5VA1B2C3E16E24E35Y015Y114Y213Y312Y411Y510Y69Y77U1674LS138+5VA0A3A2A1123U17:A74LS32WRD03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U1874LS273AD7AD6AD5AD4AD3AD2AD1AD0NMI实例2:利用三个按钮控制8个发光二极管的显示效果。两个按钮用于实现LED灯不同的点亮效果,一个用于将LED全部熄灭。原理图:源程序:OUT_LEDEQU0160HPORT1_8259EQU0164HPORT2_8259EQU0166HCODESEGMENTPUBLIC'CODE'ASSUMECS:CODESTART:CLI;关中断XORAX,AXMOVDS,AXMOVSI,80H*4;设置中断向量MOV[SI],OFFSETINTR_UPMOV[SI+2],SEGINTR_UPMOV[SI+4],OFFSETINTR_DOWNMOV[SI+6],SEGINTR_DOWNMOV[SI+8],OFFSETINTR_STOPMOV[SI+10],SEGINTR_STOPMOVDX,PORT1_8259MOVAL,00010011B;写ICW1,上升沿触发,单片工作,要设ICW4OUTDX,ALMOVDX,PORT2_8259MOVAL,80H;写ICW2,中断矢量基值为80HOUTDX,ALMOVAL,00000001B;写ICW4,完全嵌套方式非缓冲,一般EOI方式OUTDX,ALMOVAL,00000000B;写OCW1,中断屏蔽字,允许全部中断MOVAL,07FH;初始化输出端口AD0AD1AD2AD3AD4AD5AD6AD7AD8AD9AD10AD11AD12AD13AD14AD15A0A1A2A3A4A5A6A7A8A9A10A11A12A13A14A15AD16AD17AD18AD19A19A18A17A16A15A14A11A10A9A13A12A7A15A14A13A12A11A10A9A7A15A6A8A12A6A5A9A5A7A8A10A11A13A14D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U674273D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U774273U8NOTAD[0..15]ADR[0..19]RDWRAD[16..19]AD[16..19]D03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U1074273BHEAD[0..15]READY22INTR18NMI17RESET21CLK19MN/MX33HOLD/GT131HLDA/GT030A[16..19]M/IO/S028ALE/QS025DT/R/S127INTA/QS124TEST23BHE34DEN/S226RD32WR/LOCK29U18086LOAD_SEG=0x0800M/IONMI12345671011121314159U1574S133+5VA1B2C3E16E24E35Y015Y114Y213Y312Y411Y510Y69Y77U1674LS138+5VA4A3A2123U17:A74LS32WRD03D14D27D38D413D514D617D718CLK11MR1Q02Q15Q26Q39Q412Q515Q616Q719U1874LS273AD7AD6AD5AD4AD3AD2AD1AD0UPIR018IR119IR220IR321IR422IR523IR624IR725INT17INTA26CS1WR2RD3A027SP/EN16D[0..7]CAS[0..2]U198259DOWNSTOPAD[0..7]WRRDA1INTINTA8259的端口地址:0164H、0166HINTINTAA0MOVDX,OUT_LEDOUTDX,ALSTI;开中断JMP$INTR_UPPROCMOVDX,OUT_LEDUP:RORAL,1OUTDX,ALPUSHAXMOVAL,20HMOVDX,PORT1_8259OUTDX,AL;EOIPOPAXSTI;开中断IRETINTR_UPENDPINTR_DOWNPROCMOVDX,OUT_LEDDOWN:ROLAL,1OUTDX,ALPUSHAXMOVAL,20HMOVDX,PORT1_8259OUTDX,AL;EOIPOPAXSTI;开中断IRETINTR_DOWNENDPINTR_STOPPROCMOVAL,0FFHMOVDX,OUT_LEDOUTDX,ALPUSHAXMOVAL,20HMOVDX,PORT1_8259OUTDX,AL;EOIPOPAXSTI;开中断IRETINTR_STOPENDPCODEENDSENDSTART

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

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

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

×
保存成功