- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Subtract content of two ports by interfacing 8255 with 8085 microprocessor
In this program we will see how to perform subtraction 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, subtract B from A, 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||90|| ||SUB B||subtract B with A|
|F00A||D3, 82|| ||OUT 82||Send output to C|
- Interfacing ADC with 8085 Microprocessor
- Interfacing 8251 USART with 8085 Microprocessor
- Interfacing 8279 Keyboard with 8085 Microprocessor
- Interfacing 8279 Display with 8085 Microprocessor
- Interface 8255 with 8085 microprocessor for addition
- Interfacing 8253 (Timer IC) with 8085 Microprocessor
- Interfacing a simple keyboard with 8085 Microprocessor
- Interfacing a matrix keyboard with 8085 Microprocessor
- Addressing of I/O Ports in 8085 Microprocessor
- Program to Subtract two 8 Bit numbers in 8085 Microprocessor
- Interfacing 7(Seven) Segment Display to 8085 Microprocessor
- 8255 microprocessor operating modes
- 8085 program to subtract two BCD numbers
- 8085 program to subtract two consecutive bytes of an array
- 8085 Program to Subtract two multi-Byte numbers