The 2040 Printer Interface

See all articles from Sinc-Link v3 n4
Author(s): Cameron Hayne
Publication: Sinc-Link
Pub Details: Sinc-Link v3 n4 (Volume 3, Issue 4)
Date: July/August 1985
Pages: 8

a short lesson in I/O port decoding

Inside the funny shaped black box at the end of the printer cable, the one you plug into your computer, is a circuit board with a capacitor, two ferrite rods and a chip. The purpose of the capacitor and the rodsis to reduce the effects of electronic noise. The purpose of the chip, a 74LS10N triple 3-input NAND gate, is to deliver a “pay attention” signal to the printer to tell it when the computer is talking to it.

Most of the signals from the computer edge connector are not used by the 2040 printer but pass straight through the black box to be available for other, more demanding periferals such as memory expansion.

The connections and logic diagram for the chip is shown in Figure 1.

A NAND gate has an output voltage close to 5 volts (high) except if all of itsinputs are at 5 volts. In the latter unanimous case the output voltage drops to near zero volts (low). Thus we see the black wire will usually be at 5 volts. Working backwards, from right to left, we see that the only way the black wire will go low is if simultaneously A7 is high and both A2 and IORQ are low.

IORQ, which stands for input/output request, will only go low when the computer does an IN or an OUT instruction. The port number attached to the IN or OUT instruction goes onto the address bus, thus determining the voltage of signals A2 and A7. High corresponds to the bit being =1, low to the bit =0. What this all means in the case of the 2040 printer is thatt the printer will respond to any port number that has bit #7 =1 and bit #2 =0. Port number = 1????0? in binary, where the question marks can be either zero or one.

The Timex-Sinclair designated port is 251 (FB Hexadecimal) which does indeed have bit #7 =1 and bit #2 =0. But the printer will respond to 63 other port numbers as well – not a very desireable situation since other periferals may try to use those ports. This is referred to as incomplete decoding of the port address. A similar problem causes the difficulties in expanding the ZX81 to 64K.

Refering back to Figure 1, the stuff to be printed is passed out to the printer, one bit at a time, along line D7. The other data lines are used for control od the printer. The RD and WR signals are used by circuitry within the printer to tell it whether it is supposed to be printing sttuff or whether it is to being asked for a progress report.

As an additional note on port addressing, Wes Brzozowski has pointed out in SINCUS NEWS, April’85, that the decoding logic for an I/O port should check that M1 is “high” so that the periferal is not accidentally activated during an interrupt. This lack has caused some software using interrupt mode 2 to crash when certain periferals were connected.

FIGURE 1. 74LS10N connections and logic diagram
FIGURE 1. 74LS10N connections and logic diagram