In this program we will see how to perform addition by using ports to take data and send the result into the port.
Write 8085 Assembly language program for interfacing between 8085 and 8255. Here Port A and Port B are holding two values, take the numbers from port A and B, add them, and send the result at port C.
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 B, add the content, and send it to port C.
The control word register is looks like this. It is holding 92H.
The bits of control register signify like this
We are taking 92H 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 = 1 as it is acts as input 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 IN 81 indicates that taking input from port B also. The OUT 82 tells we are sending the result to port C.
|F000||3E, 92|| ||MVI A,92||Load A with Control Word|
|F002||D3, 83|| ||OUT 83||Send output to control register|
|F004||DB, 80|| ||IN 80||Take first input from port A|
|F006||47|| ||MOV B,A||Store A to B|
|F007||DB, 81|| ||IN 81||Take second input from B|
|F009||80|| ||ADD B||Add B with A|
|F00A||D3, 82|| ||OUT 82||Send output to C|