Assembly program to transfer the status of switches


In this program we will see how to transfer the switch values from one port to another using 8085 and 8255 chip.

Problem Statement:

Write 8085 Assembly language program for interfacing between 8085 and 8255. Here eight switches are connected at port A. Transfer the status of these switches into port B. In port B the LEDs are connected.

Discussion:

The task is very simple. At first we have to setup the control word register of 8255 chip. After that we will take the input from port A, and send it to port B.

The control word register is looks like this. It is holding 90H.

Bit Position
D7
D6
D5
D4
D3
D2
D1
D0
Value
1
0
0
1
0
0
0
0

 

The bits of control register signify like this

 

We are taking 90H into A. Then D7 is 1, so it is working as IO mode, the (D6 and D5) are 00, so it tells that port A is in Mode 1. D4 = 1, so port A is taking the input. The (D3 and D0) are 0 and 0. So port C is not working. And D2 = 0 as B is also in Mode 0, D1 = 0 as it is acts as output port.

In the instruction we will see OUT 83. Here 83 is the port number of Control register port. Similarly, IN 80 indicates that taking the input from port A whose port address is 80. And finally OUT 81 indicates that output port is B, and sending data from accumulator to port B.

Program:

Address
HEX Codes
Labels
Mnemonics
Comments
F000
3E, 90
 
MVI A,90
Load A with Control Word
F002
D3, 83
 
OUT 83
Send output to control register
F004
DB, 80
 
IN 80
Take input from port A
F006
D3, 81
 
OUT 81
Send output to port B
F008
C9
 
RET
Return

 

Using this program, the content of port A will be reflected back to port B.

Updated on: 30-Jul-2019

321 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements