---
title: "Master-slave 8085 bidirectional communication via 8255"
subject: "Instrumentation II"
chapter: 2
key: "semester_5/instrumentation_ii:bidirectional-8085-master-slave"
source: https://www.bctengineer.com/q/semester_5/instrumentation_ii/bidirectional-8085-master-slave
site: BCT Engineering
---

# Master-slave 8085 bidirectional communication via 8255

Instrumentation II · Chapter 2: Parallel Interfacing With Microprocessor Based System

- Asked in: 2078 Bhadra, 9 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/instrumentation_ii/bidirectional-8085-master-slave
- Whole chapter: https://www.bctengineer.com/md/semester_5/instrumentation_ii/chapter-2

## Question

Design an interfacing circuit to set up bidirectional data communication in the master-slave format between two 8085A microcomputers. Use the 8255A as the interfacing chip between the master and the slave microcomputers. What will be the port addresses and control word. Write necessary program to transfer a block of data from the master to the slave along with its flowchart diagram.

## Short answer

Each 8085 has an 8255 at I/O addresses 80H–83H. Master control word A6H configures port A mode 1 output and B input; slave B4H sets A input and B output. For 100 bytes, master polls OBF_A' before writing; slave polls IBF_A before reading.

## Answer

#### Idea
Each microcomputer has its own 8255A. Two 8-bit channels in **mode 1** are provided so that data can flow in both directions: port A carries data **master -> slave** (master port A mode 1 output, slave port A mode 1 input), and port B carries data **slave -> master** (slave port B mode 1 output, master port B mode 1 input). The handshake lines are cross connected, which gives bidirectional communication (master-slave format).

#### Interfacing circuit
```text
     MASTER 8255                      SLAVE 8255
 PA0-PA7 =========== 8-bit bus =====> PA0-PA7      (M -> S)
 PC7 OBF_A' ----------------------->  PC4 STB_A'
 PC6 ACK_A' <------[NOT]-----------   PC5 IBF_A
 PB0-PB7 <========= 8-bit bus ======  PB0-PB7      (S -> M)
 PC2 STB_B' <-----------------------  PC1 OBF_B'
 PC1 IBF_B  -------[NOT]----------->  PC2 ACK_B'
 PC3 INTR_A / PC0 INTR_B -> master RST inputs (optional)
 Common GND
```
Rule: OBF' of the sender goes to STB' of the receiver; IBF of the receiver, inverted, goes to ACK' of the sender. In mode 1 output the data stay latched on the port pins, so the receiver can take them when STB' falls.

#### Port addresses (each system I/O mapped, A7 = 1, A6-A2 = 0)
Port A = **80H**, Port B = **81H**, Port C = **82H**, Control = **83H**.

#### Control words
- Master: A mode 1 output, B mode 1 input: 1 01 0 0 1 1 0 = **A6H**.
- Slave: A mode 1 input, B mode 1 output: 1 01 1 0 1 0 0 = **B4H**.

#### Programs: transfer a block of 100 bytes from master to slave
Master (source 2000H):
```text
        MVI A,A6H
        OUT 83H
        LXI H,2000H     ; source block
        MVI B,64H       ; 100 bytes
SEND:   IN 82H
        ANI 80H         ; OBF_A' = 1 means port free (last byte taken)
        JZ SEND
        MOV A,M
        OUT 80H         ; byte to port A, OBF_A' goes low
        INX H
        DCR B
        JNZ SEND
        HLT
```
Slave (destination 3000H):
```text
        MVI A,B4H
        OUT 83H
        LXI H,3000H
        MVI C,64H
RECV:   IN 82H
        ANI 20H         ; IBF_A = 1 means a byte arrived
        JZ RECV
        IN 80H          ; read byte, IBF_A cleared, master gets ACK
        MOV M,A
        INX H
        DCR C
        JNZ RECV
        HLT
```

#### Flowchart
```text
 Master                     Slave
 Initialise 8255 (A6H)      Initialise 8255 (B4H)
 HL = source, B = count     HL = destination, C = count
 Read port C                Read port C
 OBF_A' = 1? --no--> loop   IBF_A = 1? --no--> loop
 | yes                      | yes
 Send byte (OUT 80H)        Read byte (IN 80H), store
 HL+1, B-1                  HL+1, C-1
 B = 0? --no--> loop        C = 0? --no--> loop
 | yes                      | yes
 Stop                       Stop
```
For slave -> master transfer the same routines are used with port B (81H) and the bits OBF_B' (D1) and IBF_B (D1) of port C.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is bidirectional communication obtained between the two 8255s?
   A. One port in mode 0 for both directions
   B. Port A mode 1 for master-to-slave and port B mode 1 for slave-to-master with cross-connected handshake
   C. Port C lines carry all data
   D. Using mode 2 on port B
   Answer: B. Each 8-bit channel is one-way; two channels give both directions. (Key point: Two channels)

2. What is the rule for connecting handshake lines?
   A. Sender OBF' goes to receiver STB'; receiver IBF (inverted) goes to sender ACK'
   B. Sender IBF to receiver OBF'
   C. STB' to STB' directly
   D. OBF' to ACK' of the same chip
   Answer: A. OBF' becomes the strobe for the receiver, and IBF inverted becomes the acknowledge. (Key point: Handshake wiring)

3. What are the master and slave control words?
   A. Master A6H, Slave B4H
   B. Master B4H, Slave A6H
   C. Both A6H
   D. Master 92H, Slave 90H
   Answer: A. Master: A mode 1 out, B mode 1 in = A6H. Slave: A mode 1 in, B mode 1 out = B4H. (Key point: Control words)

4. How does the master send a byte?
   A. Waits for IBF_A and reads
   B. Sends without checking
   C. Waits for INTR_B
   D. Checks OBF_A' = 1, then outputs the byte to port A
   Answer: D. OBF_A' = 1 means the previous byte was taken, so a new byte can be sent. (Key point: Master program)

## Related in Instrumentation II

- [ADC804 with 8255 control word and program](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc804-8255-program) — Instrumentation II, chapter 4
- [8-channel ADC interface with 8255 and 8085](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc8-8255-problem) — Instrumentation II, chapter 4
- [8255A at 80H: addresses, mode 0/1 words, BSR](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-80h-addresses-control) — Instrumentation II, chapter 2
- [ADC with 8085 using 8255: fan and heater control](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc-8255-fan-heater) — Instrumentation II, chapter 4
- [8255 port addresses from decoder figure](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-port-addresses-decoder-fig) — Instrumentation II, chapter 2
- [Interfacing ADC0808 with 8085 using 8255A](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc0808-8255-interface) — Instrumentation II, chapter 4

## Related in other subjects

- [Master-slave JK flip-flop](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Amaster-slave-jk) — Digital Logic, chapter 6
- [Short note: Client-Server and Master-Slave](https://www.bctengineer.com/question.md?key=semester_8%2Fbig_data_technologies%3Ashort-note-client-server-master-slave) — Big Data Technologies, chapter 1
- [Booking format for two-set horizontal angle](https://www.bctengineer.com/question.md?key=semester_3%2Fsurveying_i%3Abooking-format-two-set-horizontal-angle) — Surveying I, chapter 7
- [Flow control mechanisms in data communication](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Aflow-control-mechanisms) — Telecommunications, chapter 8
