问题–在8085中编写一个汇编语言程序,在8085和8255之间进行接口连接。在端口A上连接了8个交换机。将这些交换机的状态转移到连接LED的端口B中。
例子 –
输入端口为A,输出端口为B。
算法 –
- 构造控制字寄存器
- 从端口A输入数据
- 在端口B中显示结果
程序 –
Mnemonics | Comments | ||
---|---|---|---|
MVI A, 90 | A ← 92 | ||
OUT 83 | Control Register ← A | ||
IN 80 | A → Port A; | OUT 81 | Port C A ← A |
RET | Return |
解释 –
- MVI A,92表示控制寄存器的值为92。
D7=1 as it is in I/O mode D6=0 & D5=0 as Poet A is in m0 mode D4=1 as Port A is taking input D3=0 & D0=0 as Port C is not taking part D2=0 as mode of Port B is m0 D1=0as Port B is displaying the result
- OUT 83将A的值放入端口控制寄存器的端口号83H中。
- IN 80从80H输入,这是端口A的端口号。
- OUT 81在81H中显示结果,它是端口B的端口号。
- RET回报