---
title: "8255A at B0H: add port A and B, show on port C"
subject: "Instrumentation II"
chapter: 2
key: "semester_5/instrumentation_ii:ppi-b0h-addition"
source: https://www.bctengineer.com/q/semester_5/instrumentation_ii/ppi-b0h-addition
site: BCT Engineering
---

# 8255A at B0H: add port A and B, show on port C

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

- Asked in: 2078 Kartik, 3+5 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/instrumentation_ii/ppi-b0h-addition
- Whole chapter: https://www.bctengineer.com/md/semester_5/instrumentation_ii/chapter-2

## Question

Draw the circuit diagram to interface 8255A PPI with 8085 microprocessor at base address B0H. Write an assembly program that determines the addition of contents of port A and port B and display the result in port C. Use appropriate control word to initialize the 8255A.

## Short answer

Port addresses: A=B0H, B=B1H, C=B2H, Control=B3H. Control word 92H configures ports A and B as inputs, port C as output in mode 0. Program reads ports A and B, adds the values, and outputs the sum to port C.

## Answer

#### Circuit (I/O mapped, base B0H)
B0H = 1011 0000. A7 = 1, A6 = 0, A5 = 1, A4 = 1, A3 = 0 and A2 = 0 are decoded; A1 A0 select the register. Ports: A = **B0H**, B = **B1H**, C = **B2H**, Control = **B3H**.
```text
 A7 ------------------+
 A6 --[NOT]-----------+
 A5 ------------------+
 A4 ------------------+--[ 7-input NAND ]--> CS' (low when selected)
 A3 --[NOT]-----------+
 A2 --[NOT]-----------+
 IO/M -----------------+  (high for I/O)
 A1, A0 -> A1, A0     IOR' -> RD'     IOW' -> WR'
 AD0-AD7 -> D0-D7 (data)   RESET OUT -> RESET
 PA0-PA7 <- input data 1   PB0-PB7 <- input data 2
 PC0-PC7 -> output display (LEDs)
```
(A6, A3 and A2 are inverted so that the NAND output goes low only when A7-A2 = 101100 and IO/M = 1.)

#### Control word
Port A input (D4 = 1), port B input (D1 = 1), port C output (D3 = 0, D0 = 0), mode 0, D7 = 1: 1001 0010 = **92H**.

#### Program
```text
        MVI A,92H
        OUT B3H         ; initialise 8255
        IN B0H          ; read port A
        MOV B,A         ; save in B
        IN B1H          ; read port B
        ADD B           ; A = A + B
        OUT B2H         ; display sum on port C
        HLT
```
If the sum exceeds 255 (carry set), only the low 8 bits are displayed. The carry can be shown on another line with `MVI A,00H`, `RAL` and a separate output.

## Check yourself

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

1. With base B0H, what is the control register address?
   A. B1H
   B. B2H
   C. B3H
   D. B4H
   Answer: C. A1 A0 = 11 gives B0H + 3 = B3H. (Key point: Address map)

2. Port A input, B input, C output, mode 0. Control word?
   A. 90H
   B. 92H
   C. 93H
   D. 82H
   Answer: B. D7=1, D4=1, D1=1, D3=0, D0=0 gives 1001 0010 = 92H. (Key point: Control word)

3. How does the program add port A and B?
   A. Read C, add to A, store in B
   B. IN port A into B register, IN port B, ADD B, OUT port C
   C. Output A and B directly
   D. Use IN 80H then ADD M
   Answer: B. A holds port B data, ADD B adds the saved port A data, then OUT B2H displays it. (Key point: Program method)

4. What happens to a sum greater than 255 in this basic program?
   A. Only the low 8 bits are displayed; carry needs separate handling
   B. The sum is displayed in 16 bits
   C. The program halts
   D. The carry is lost silently and flagged on port A
   Answer: A. 8-bit addition sets carry; showing it needs an extra output step. (Key point: Carry limit)

## Related in Instrumentation II

- [ADC at 80H with 8255A: display on port B LEDs](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc-8255-80h-leds) — Instrumentation II, chapter 2
- [8255A card at F3H with keyboard and display](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-f3h-keyboard-display) — Instrumentation II, chapter 2
- [Keyboard and printer with 8255A at 4044H](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Akbd-printer-ppi-4044h) — Instrumentation II, chapter 2
- [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
- [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
- [Changing 8255A base address](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-base-address-change) — Instrumentation II, chapter 2

## Related in other subjects

- [8085 ALP: add upper and lower nibbles](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aalp-8085-add-nibbles) — Microprocessor, chapter 2
- [8085 ALP: add two tables, sum and carry](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aalp-8085-add-two-tables) — Microprocessor, chapter 2
- [Protected specifier; student/test/result program](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aprotected-three-class-program) — Object Oriented Programming, chapter 6
- [Address decoding for 8 LEDs output port](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Adecoder-output-port-8-leds) — Microprocessor, chapter 4
