1、微机原理与接口技术 霓虹灯程序设计微机原理实验报告课 题 名: 霓虹灯设计 班 级: 学 号: _ 姓 名: 指导教师: 实验目的在熟悉8086/8088指令系统的基础上,掌握8086/8088汇编语言程序设计方法;掌握8259可编程中断控制器,8255可编程并行接口的应用。 实验要求模拟霓虹灯(实验箱中的发光二极管)交替变换的过程。用8255设计霓虹灯,三种以上变化:设计程序控制8个并排LED灯霓虹灯至少4种不同的状态的变换,选择8255的任一数据端口连接发光二极管模拟。运行过程中可随时中断退出。 实验原理可通过DVCC8086单板机上的8255芯片来实现,利用8255A中的PC口,将其8位
2、输出PC7PC0分别与8个LED灯L1L8相连,当PC口其中某位输出为“0”时,则对应LED灯亮。通过编程先对8255进行初始化,选择控制字,设置PC口为输出方式,然后给8088CPU中的AH赋值0EFH,采用循环移位指令对AH中的数值0EFH进行移位,最后将移位后的数据输到PC口,从而使8个LED灯按要求依次逐一点亮。 其他变化原理类似。 实验内容 八个灯半亮,半灭; 依次从左向右亮,从右向左亮,循环三次; 两边往中间,中间往两边亮,循环三次; 单数灯依次从左向右亮,双数灯依次从右往左亮,循环三次。 流程图 程序代码STACK SEGMENT STACK DW 64 DUP(?)stack
3、endsCODE SEGMENT ASSUME CS:CODE,SS:STACK START: CLI MOV BX,0010H MOV AL,80H OUT 63H,AL PUSH DS MOV AX,0000H MOV DS,AX MOV AX,OFFSET IRQ1 ADD AX,2000H MOV SI,0024H MOV SI,AX MOV AX,0000H MOV SI,0026H MOV SI,AX MOV AX,OFFSET IRQ5 ADD AX,2000H MOV SI,0034H MOV SI,AX MOV AX,0000H MOV SI,0036H MOV SI,AX
4、POP DS IN AL,21H AND AL,0DDH OUT 21H,AL MOV AL,0FFH OUT 61H,ALa10: STI CMP BX,0000H JZ A11 JMP A10a11: STI MOV CX,3A1: MOV AL,80H ;半亮,半灭 OUT 63H,AL MOV AL,00H OUT 61H,AL CALL DALLY1 MOV AL,0FFH OUT 61H,AL CALL DALLY1 MOV AL,80H OUT 63H,AL MOV AL,0F0H OUT 61H,AL CALL DALLY1 MOV AL,80H OUT 63H,AL MOV
5、AL,0FFH OUT 61H,AL CALL DALLY1 MOV AL,0FH OUT 61H,AL CALL DALLY2 LOOP A1 MOV CX,3A2: MOV AL,07EH ;两边往中间,中间往两边 OUT 61H,AL CALL DALLY1 MOV AL,0BDH OUT 61H,AL CALL DALLY1 MOV AL,0DBH OUT 61H,AL CALL DALLY1 MOV AL,0E7H OUT 61H,AL CALL DALLY1 MOV AL,0E7H OUT 61H,AL CALL DALLY1 MOV AL,0DBH OUT 61H,AL CALL
6、 DALLY1 MOV AL,0BDH OUT 61H,AL CALL DALLY1 MOV AL,07EH OUT 61H,AL CALL DALLY2 LOOP A2 MOV CX,2A3: MOV AL,07FH ;依次亮,左右 OUT 61H,AL CALL DALLY1 MOV AL,0BFH OUT 61H,AL CALL DALLY1 MOV AL,0DFH OUT 61H,AL CALL DALLY1 MOV AL,0EFH OUT 61H,AL CALL DALLY1 MOV AL,0F7H OUT 61H,AL CALL DALLY1 MOV AL,0FBH OUT 61H
7、,AL CALL DALLY1 MOV AL,0FDH OUT 61H,AL CALL DALLY1 MOV AL,0FEH OUT 61H,AL CALL DALLY1 MOV AL,0FEH OUT 61H,AL CALL DALLY1 MOV AL,0FDH OUT 61H,AL CALL DALLY1 MOV AL,0FBH OUT 61H,AL CALL DALLY1 MOV AL,0F7H OUT 61H,AL CALL DALLY1 MOV AL,0EFH OUT 61H,AL CALL DALLY1 MOV AL,0DFH OUT 61H,AL CALL DALLY1 MOV
8、AL,0BFH OUT 61H,AL CALL DALLY1 MOV AL,07FH OUT 61H,AL CALL DALLY2 LOOP A3 MOV cx,3A4: MOV AL,07FH ;单数依次从左向右亮,双数依次从右向左亮 OUT 61H,AL CALL DALLY1 MOV AL,0DFH OUT 61H,AL CALL DALLY1 MOV AL,0F7H OUT 61H,AL CALL DALLY1 MOV AL,0FDH OUT 61H,AL CALL DALLY1 MOV AL,0FEH OUT 61H,AL CALL DALLY1 MOV AL,0FBH OUT 61
9、H,AL CALL DALLY1 MOV AL,0EFH OUT 61H,AL CALL DALLY1 MOV AL,0BFH OUT 61H,AL CALL DALLY2 LOOP A4 MOV AL,0FAH OUT 61H,AL CALL DALLY2 LOOP A4 MOV CX,3 JCXZ A12 JMP A11 a12: INT 21Hirq1: MOV AL,0FFH OUT 61H,AL MOV AL,20H OUT 20H,AL HLT IRETirq5: MOV BX,0000H MOV AL,20H IRETDALLY1 PROC PUSH AX PUSH CX MOV
10、 CX,0040HB1: MOV AX,0200HB2: DEC AX JNZ B2 LOOP B POP AX RETDALLY1 ENDPDALLY2 PROC PUSH AX PUSH CX MOV CX,0200HB3: MOV AX,0200HB4: DEC AX JNZ B4 LOOP B3 POP CX POP AX RETDALLY2 ENDPCODE ENDS END START 程序及硬件系统调试情况在Wmd86调试软件里面打开程序,首先编译改程序,此时会弹出一个编译出错对话框,按提示的出错行数对应进行修改,修改完后再编译汇编链接。实验步骤 一 关闭DVCC8086电源,按要求连接线路:8255芯片PB口输出端PB0PB7依次接D0D7IRQ5开始连接kk2IRQ1中断连接kk1 打开DVCC8086电源,输入u2000来查询程序是否装入,装入后键入G=2000,然后按下kk2观察指示灯的显示状态,然后按下kk1观察指示灯的亮灭情况。 设计总结与体会经过这一周的专周, 做关于霓虹灯实验设计,我认真查阅资料,学习关于这方面的知识, 才真正体会到了其中的不易,每一个设计环节,稍有疏忽实验将难以成功。有了这次实验设计的经历,我想以后再遇到类似的问题我将会考虑的更加全面一些。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1