Skip to main content

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

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.

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.

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.

 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

        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.

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 2 questions →