Skip to main content

Centronics printer with 8255A in mode 1

Short answer

Connect 8255A to 8085 with base address 80H–83H. Port A in mode 1 output sends data; OBF_A' provides STROBE and PC6 receives ACK. Control word 10100000 (A0H) configures port A; use BSR 0DH to enable interrupt. ALP polls OBF (bit 7 of port C) before writing each character from 9000H until 00H.

Interface a parallel bus centronics printer with 8085 microprocessor using 8255A in mode 1 output configuration. (a) Draw the necessary interfacing circuit required for this purpose using 8255 PPI in handshake mode. (b) Determine port address as per your chip select logic. (c) Determine the control word required for printing operation. (d) Draw the timing waveform for transferring data to the printer. (e) Write an ALP to print characters whose ASCII code is available in memory location from 9000H.

Assumptions

8085 system, 8255A I/O mapped at 80H-83H; port A in mode 1 output sends data to the printer. Centronics signals: DATA0-DATA7, STROBE' (from computer), ACK' (from printer).

(a) Interfacing circuit

 8085                      8255A                Centronics printer
 AD0-AD7 (data) -------> D0-D7
 IOR' -> RD'  IOW' -> WR'  RESET OUT -> RESET
 A1,A0 -> A1,A0
 A7..A2 decoder -> CS'
                          PA0-PA7 ---------> DATA0-DATA7
                          PC7 OBF_A' -------> STROBE'
                          PC6 ACK_A' <------- ACK'
                          PC3 INTR_A -------> 8085 RST 5.5

OBF_A' is used as the strobe to the printer (some printers need a short pulse; a 74LS123 monostable can be added).

(b) Port addresses

A7 = 1, A6-A2 = 0 gives CS' low: Port A = 80H, Port B = 81H, Port C = 82H, Control = 83H.

(c) Control word

D7 = 1; D6D5 = 01 (A mode 1); D4 = 0 (A output); D3 = 0; D2 = 0; D1 = 0; D0 = 0 = 1010 0000 = A0H. Interrupt enable INTE_A (PC6): BSR 0DH.

(d) Timing waveform

 WR'    --\__/--------------------------
 PA0-7  ----< character >---------------
 OBF'   -----\_________/----------------   (= STROBE' to printer)
 ACK'   ---------------\_______/--------
 INTR   _______________________/--------

When the CPU writes the character, WR' goes high and the data appears on PA0-PA7. OBF' goes low at the same time and acts as STROBE' to the printer. The printer takes the data and returns ACK' low, which makes OBF' go high again. When ACK' returns high, INTR goes high (if INTE_A = 1) to tell the CPU that the next character can be sent.

(e) Assembly program: print characters starting at 9000H (end marker 00H)

        MVI A,A0H
        OUT 83H         ; port A mode 1 output
        LXI H,9000H     ; pointer to characters
NEXT:   MOV A,M
        CPI 00H         ; end of text?
        JZ  DONE
        MOV B,A         ; keep character
WAIT:   IN 82H          ; read status (port C)
        ANI 80H         ; OBF_A' (D7) = 1 means printer took last byte
        JZ  WAIT
        MOV A,B
        OUT 80H         ; send to printer
        INX H
        JMP NEXT
DONE:   HLT

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 2 questions →