Skip to main content

Keyboard and printer interface in 8255 mode 1

Short answer

Port A mode 1 input (keyboard, interrupt-driven), port B mode 1 output (printer, status check). Control word B4H; enable keyboard interrupt with BSR 09H. Addresses: A=80H, B=81H, C=82H, control=83H (I/O mapped). Printer status checked via OBF_B' (PC1).

Interface a keyboard and a printer in mode 1. Port A is designed as input for keyboard with interrupt I/O port B is designed as output for printer with status check I/O. Draw the mapping circuit and write the control word and address map.

Assumptions

8085, 8255 I/O mapped at 80H-83H. Keyboard encoder on port A (interrupt driven, mode 1 input); printer on port B (status check, mode 1 output).

Signals (mode 1)

Port C pinSignalUse
PC4STB_A'Strobe from keyboard
PC5IBF_AAcknowledge to keyboard
PC3INTR_AInterrupt to 8085 (RST 6.5)
PC1OBF_B'Data ready to printer
PC2ACK_B'Acknowledge from printer
PC0INTR_BNot used (status read instead)

Mapping circuit

 A7 ------------+                 +--------------+
 A6..A2 [NOR]---+--[AND]--[NOT]->CS'            |
 IO/M(=1) ------+                 |    8255A     |
 A1, A0 ------------------------> A1, A0         |
 IOR' -> RD'   IOW' -> WR'  RESET OUT -> RESET   |
 AD0-AD7 -> D0-D7                                |
 PA0-PA7 <- keyboard   PB0-PB7 -> printer        |
 PC4 <- STB' PC5 -> IBF PC3 -> RST 6.5           |
 PC1 -> printer DATA READY  PC2 <- printer ACK   +

CS' is low when A7 = 1 and A6-A2 = 00000.

Address map

A1 A0PortAddress
00Port A (keyboard)80H
01Port B (printer)81H
10Port C (status)82H
11Control83H

Control word

D7 = 1 (mode set), D6D5 = 01 (port A mode 1), D4 = 1 (A input), D3 = 0 (PC6, PC7 output, unused), D2 = 1 (B mode 1), D1 = 0 (B output), D0 = 0 = 1011 0100 = B4H. INTE_A enable (keyboard interrupt): BSR 0000 1001 = 09H (set PC4). Printer status is checked by reading port C bit D1 (OBF_B' = 1 means printer took the previous byte).

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 2 questions →