1 / 11

使用实现 A 口作为输入口、 B 口作为输出口

使用实现 A 口作为输入口、 B 口作为输出口. 【 实验要求 】. 1. 编程要求:编写汇编语言程序。 2. 实现功能: IOA 低八位端口作为按键输入口, IOB 低八位端口作为输出口,控制 8 个发光二极管,实现键控 LED 灯(发光二极管)的显示。 3. 实验现象:不同的发光二极管点亮表示有不同的键按下。当第一个按键按下时,第一个发光二极管点亮,第 i ( 1≤i≤8 )个按键按下时,第 i ( 1≤i≤8 )个发光二极管点亮。. 【 实验原理 】. 1. I/O 口的设置

tori
Download Presentation

使用实现 A 口作为输入口、 B 口作为输出口

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 使用实现A口作为输入口、B口作为输出口

  2. 【实验要求】 • 1. 编程要求:编写汇编语言程序。 • 2. 实现功能:IOA低八位端口作为按键输入口,IOB低八位端口作为输出口,控制8个发光二极管,实现键控LED灯(发光二极管)的显示。 • 3. 实验现象:不同的发光二极管点亮表示有不同的键按下。当第一个按键按下时,第一个发光二极管点亮,第i(1≤i≤8)个按键按下时,第i(1≤i≤8)个发光二极管点亮。

  3. 【实验原理】 1. I/O口的设置 SPCE061A的I/O口可以被单独定义为输入或者输出口,它们的输入输出方式是由方向控制向量Dir、属性向量Attrib、数据向量Data的组合设置确定的,组合控制设置表如本章实验三表 1-4。 比如IOA口低八位被设置为带下拉电阻的输入口、IOB口低八位被设置为同相低电平输出口

  4. 高低电平发生按键电路模块工作原理 • 实验箱高低电平发生按键电路的原理图如图 所示。IO端口设置为带下拉电阻的输入口,当键按下时,在IO端口可检测到高电平;不按时,IO端就保持低电平。

  5. 键盘程序流程图 键盘程序是利用延时的方法进行消抖处理的:先读取IOA口键值保存在寄存器,判断读回值是否为零,为零则表示没有键按下,返回零;非零则延时大约30ms后再次读取IOA口键值,比较两次读取的键值是否相同,如果相同则返回键值,否则返回零。

  6. 上机作业: • 实现IOB低8位输入IOA低8位输出

More Related