No. 114, December 1994

Microcomputer Interfacing 2.

By: Dave Rowntree

In the first part of this series, we saw how the Z80 is connected to its permanent and temporary memory ICs to form the central block in our hypothetical microcomputer. We can now go on to look at the way this block can be interfaced to the user in the simplest possible way. Our aim here is to connect a 16 key (4 X 4 matrix) keypad as the input device and a 4 digit, 7 segment LED display to provide visual user feedback. We will need to introduce a further IC for handling this arrangement but first we can take a look at the keypad itself to see how it will operate when actually connected. With diagrams following on from part one, Fig. 10 shows that we can expect to find four Row connections, RI - R4; and four column connections, C 1 - C4. The interfacing device will rapidly scan the columns in turn so that a sequential active high pulse-train appears on all the column connections. Pressing a key will connect one of the rows to the active column and the scanning pulses appear as data to be read by the interface IC and loaded onto the system data bus. The column wires are therefore connected to the appropriate port outputs of the interface device whilst the rows connect to the inputs of the same port.

Fig. 10 Fig. 11

Providing visual user feedback is a four digit 7 segment display, one simplified section being shown in Fig. 11. The 4 bits of output data from the interface IC is converted to 7 lines suitable for driving the LED segments via resistors. Bridging the keypad and 7 segment converters is the interface device itself, the 8255 PIA (Peripheral Interface Adapter) shown in Fig. 12. Ports A and B each have eight output data pins which together provide the 16 lines required for connection to the four 4 bit binary to 7 segment converters. PA0 is thus the lowest binary weighting and PB7 the highest. As with all other ICs in a microcomputer system, the data pins are simply connected directly to the data bus and receive or load data under CPU control. The remaining pins of the PIA control its functions and therefore connect to the CPUs system control. Fig. 13 shows how the keypad and display are connected to the PIA.

Fig. 12 Fig. 13

Note that Port C lower binary weightings connect to the keypad columns and the higher weightings to the rows. Fig. 14 shows how the system control and address lines connect to the CPU. Finally, the micro-computer has to have a system clock to drive it and an initializing reset to ensure the system switches on in a known state. Fig. 15 shows the conFig.uration we need to use in our system. It will be noted that there are very few passive components in a basic microcomputer. The main consideration in this article is to understand how each device connects to the Central Processing Unit via a system of common lines. When the relative simplicity of this becomes more evident, it should be an easier matter to follow the complete system diagram for a simple microcomputer such as the one described The next part of this series will explain the various programming modes of the Z80 and how to get our system one step further towards a working computer.

Fig. 14 Fig. 15