Adding the Keyboard
To keep things compact and simple, I've used the 74C923 keyboard interface IC. This chip takes care of a number of functions automatically, simplifying the MAG-85's circuit considerably. It automatically scans a matrix keyboard, debounces the keys, and buffers the result of a keypress while passing a signal to the host system to let it know that data is available. It's a very nice package.
Hooking It Up
Here is the diagram showing how the 74C923 is hooked up:
The keyboard I'm using for the prototype is an experimenter keyboard from B.G. Micro. It's a 5x5 membrane matrix keyboard. This circuit only uses 4 columns of the 5 on the B.G. Micro keyboard. For the permanent version of the MAG-85, I'm planning on building up a keyboard out of keyswitches.
The values of C and 10C above that I'm using are 0.01uF and 0.1uF. The 74C923 uses these to set the scan rate and debounce times for the keyboard.
The IN 0 SEL. line shown above is connected to the Y0 output of one of our 74138 ICs, as shown here:
I/O Select Circuit Showing Select Lines to LCD Latch and Keyboard Encoder
This line is used by the 8085 to select the 74C923 to read data from it into the 8085.
The DA (Data Available) line on the 74C923 is hooked to the RST6.5 input of the 8085. Whenever a key is pressed, this line will trigger the RST6.5 interrupt on the 8085 (if it has been enabled, as it is in our software from earlier). At present, all our software does it signal that a RST6.5 interrupt has been received by printing "RST6.5" on the LCD display. Pressing any key on the keyboard has the same result, at present. But once the keyboard and its interface have been added to the circuit, this gives us an easy way of testing to make sure that at least this much of the new hardware is functioning as expected.
Next: Reading the Keys
At present, our software does not read the key values from the 74C923. The next task we have will be to add this ability. If the 74C923 has been connected to the system as shown above, we can read the key value using the 8085's IN command on port 0.