Z80 Space-Time Productions Single Board Computer
Technical Support Information
Control Panel Using 8279 Keyboard/Display Controller
|
The Original Space-Time Productions Keypad The 8279 has some great features, and is still found in some medical equipment, etc. The problem arises in that it is not directly capable of driving any form of display. This IC design leaves a few things to be desired, but this allows for it's flexibility. You can directly connect a 4x8 keypad to its inputs without any other interfacing hardware. The main problem is the display; everything on the display outputs must be inverted to drive normal devices. The SLn lines are fine for pulling a row low, but for driving the display they usually need to be sourcing current out to something, thus inverted. The Space-Time keypad pcb accomplished this by using PNP transistors to act as switches to pass voltage to the MAN72 display anodes. When their base goes low, they conduct current across. Likewise, the 8279's segment driver outputs can't sink much current, so those were also sent to transitors (NPN this time) which acted as inverting switches to provide a low for the segments of the 7-seg displays [a "1" would light a segment]. The keypad itself provided only rudimentary inputs and was one of those wretched membrane type pads. These don't provide good tactile feel or feedback and are prone to wearing out commonly used keys (e.g. - "Enter").
Background Discussion
This portion of the project was to replace the very sad looking original panel, with its hand-sawed hole for the LCD display. It also had a hole in the front for the original 3-1/2" diskette drive (mounted vertically...), which I had covered with translucent tape. This poor thing did its job for several years now, but it's high time for retirement. I have seen (and you have, too) a number of Z-80 Single Board Computers that are cheesy and have very abbreviated "monitor" functions only with a hexadecimal keyboard on them. While these may be able to do some interesting jobs and teach basics of microprocessors, they are weak applications which strangle a rather powerful microprocessor. The displays on these machines are usually little more than 7-segment memory-location/contents displays that allow the user to hand-enter programs byte-at-a-time, have a small keypad that must be scanned by the microprocessor code, taking up valuable time. They have little I/O capabilities and even smaller areas for program memory. These computers put extreme limits on what can eventually be done with them. You have to remember that the Z-80 was the chip that pioneered CP/M and brought some of the first real applications such as word processing, spreadsheets, and database programs to life in computer systems. The book for the movie 2010: Odyssey Two was written by Arthur C. Clarke on a Kaypro, a full-up professional computer system whose heart was a Z-80 microprocessor. These applications made full usage of the Z-80 and there have been many carry-overs from this operating system that became the basis for DOS, and a full suite of applications. This was the not-so-feeble beginnings of what would become today's computing systems. I determined that after all the time and research I had put in, that my Space-Time Productions Z-80 wasn't going to end up as one of those rudimentary computers. While I'm not ready to turn this into another CP/M system, there was a compromise to be struck between an elementary monitor program and a full operating system. Because many of my applications for this computer are I/O driven, I wanted some type of user interface so that I could perform some of the basic functions needed, but wanted to incorporate the more elaborate LCD display and keypad. The purpose of this was two-fold:
The first step of this is to take all the monitor functions to the front panel. This will leave the Serial Port A only as a Load/Save resource. I intend to, at some point, to either create some sort of storage format that will use RS-232 serial data. Motorola has a similar device for their PageBridge paging base station, but stores to 3.5" diskettes from serial data. While this seems like a practical plan, I think at some point I will have figured out how to incorporate an IDE hard drive to the system by then. Another project for much farther down the road. In the meantime, using the non-volatile ram, it will be practical to "Pre-Load" all the needed programs and just run them from the front panel as required. Since there is no need for data recording and storage of this type, the current condition of the computer should be usable for some time to come. Design begins I started fresh with a blank 3U standard rack-mount panel (again, salvage r us). It is 1/8" thick aluminum, and already had the holes for rack-mounting. I love this fact, but hopefully I won't ever be forced to rack mount it - I'm hoping it will be my desktop companion forever. By the way, the cabinet has rubber feet on the bottom. Among my many blessings - a huge salvage operation (translated "Dumpster Dive") resulted in a wonderful gathering of LED-lit push-button switches. These have internal flat LED's with surface-mount resistors. You can apply +5 Volts directly to the contacts - they glow brightly, but pull an average 115mA each indicator. There are:
So I sat down to CAD and drew up the design I wanted for my new panel, using these switch dimensions. I printed it out full-size, with dimension marks, etc. I gave the blank panel and the drawing to a friend of mine at work during the Spring of 2005. He said it would take about 2 hours to machine all the holes for the switches. I expected it the following Monday.
Six Months Later
Well, after buying Equipment Gray primer and Krylon Flat Black, I decided the best way to do this is to go ahead and sand this booger all the way down to the metal. I didn't take very long, and I was glad to have my filter mask hanging around - that paint dust gets everywhere. So I sanded the textured paint off and got it down to a bare metal. It took all weekend to paint this thing; All Saturday to spray 3 light coats of primer, giving it several hours in between coats [I found out this is VERY important for adhering to the aluminum surface]. I was blessed to have plenty of sunshine and little wind so I could let it dry on the back patio on this Fall day.
Next, the flat black Krylon is sprayed on in 4 very light coats, giving it several hours between coats to thoroughly dry. The result it incredible, sorry the picture hardly does it justice. It is a very smooth and clean spray without glitches. One thing I can tell you from past experience - this process looks wonderful, but as I demonstrated on the backside just for grins - a screwdriver or any tool can put a very visible scratch on the surface. And you won't be able to paint back over it, either - the gouge into the primer will be visible even when re-sprayed. Best to sand lightly with a fine grade of sandpaper, and start the final coats again. Monday morning, I snapped the switches all in. It looks amazing. Then I sat it on some discarded bubble-wrap to keep the paint from getting chipped while I solder the switches up.
This is the keyboard inserts transparency. [PS - I found a Windows font that looks very similar to the pixelation font on the HD44780 LCD display, so I used it to create the large numbers on the green indicators so it wouldn't look cheesy.] As of December 23, 2005 I have accomplished:
Still left to do:
My application, I chose to run the SLn lines thru a ULN2003 Inverter/Driver. The outputs of this I pulled high with a 1K resistor, and this fed the base of a TIP121 transistor. This transistor acts as the floodgate for +5V to be switched onto the row of the switches/indicators. In the normal state, the "high" from the 8279 unselected row is inverted. That low from the ULN2003 keeps the base of the TIP121 transistor from switching on and delivering current to drive that row. When the row is selected, the low is inverted, the ULN2003 goes into "open collector" mode, the 1K pulls the base high, and the TIP121 passes the 5Volts onto that particular row. I determined if all 8 output bits were set, the entire row would pull 8 x 115mA - nearly 1 full Amp, so I needed a transistor to cooly switch that amount of current without sweating. So there are 4 of these circuits, one for each SL pin of the 8279. Again, see the schematics page for this circuit. That pretty well wraps up the hardware. See the schematics on the Hardware menu, sheet 7.
Software The next challenge is to handle this fine array of keys. Until this point in time, all the user inputs to the Space-Time Productions Z-80 computer have been by way of Hyperterminal on my PC talking to the Serial A port of the Z-80. Only a few switches on the avionics panels have been used for much other than to test-drive the avionics panel itself. I have disassembled and heavily commented the 8279.BIN file that Ron Weiss sent me for use with the 8279 version of the computer. So, I'm not in unfamiliar territory at all (yet - ha).
8279 Operating System Rom The main part of the keypad is set up as a 4x8 array. The 8279 outputs row strobes (active low) on pins SL0, SL1, SL2, and SL3. This "low" provides the ground needed to detect a key-contact closure on the column inputs to the 8279 (R0 thru R7), which are pulled "high" by internal resistors. So my keys are in an 8X by 4Y cartesian grid. As you can calc, this gives a total of 32 keys. Not very many functions. But the 8279 has that taken care of. There are additional inputs for SHIFT and CONTROL keys. This allows for several layers of functions for each key:
This gives a total of 4 x 32 possible switch combinations = 128 possible codes. This code is read back in the data word where:
In my application (4x8 matrix), D6 bit will always be "0", so I wanted to rotate that bit out of the value. Also, in order to create a table that command vectors can be loaded from I did this:
With this code in place, the keys give results from $00 to $FE, skipping the value in between (because D0 always equals "0" after the code runs). This way I can use A to offset the value of the start of the vector table. Add the key value directly into HL using some command like:
One thing I neglected to say that may impact your application is that the SLn pins on the 8279 can be set to either be a 1-of-4 selection in which the selected row goes low, OR it can be set so that the SL0-SL3 pins provide an encoded Hex output that must be passed thru a decoder (e.g. 74LS138). The setback is, for the keyboard the maximum is 8 rows - only SL0, SL1 and SL2 are used in this mode, [but only for the keyboard]; for a total of 8 x 8 keys = 64 keys. This is then multiplied by the Shift and Control combinations so there are a total of 256 possible key combinations. With that said, the same 4 SLn pins also provide a four-bit encoded word for the 16-character display. This can be decoded by an IC such as the 74LS154 4-to-16 decoder. So while it is re-strobing the keyboard, it is only then drawing the upper half of the display characters. To make a long story short, if you use the non-encoded method - you don't have to provide any external hardware or signal conditioning. Simply strap your keyboard across the SLn pins and the R0 thru R7 pins and go straight to work. If a 4x8 (or smaller) keyboard will work for your application, then this is by far the best method as far as wiring and so on.
NOTE:
The New 8279 Monitor Rom In order for you to keep tabs on where I'm at in development, I'm going to try to keep an up-to-date version of the current TEST.ASM, which is the file I use to develop and debug routines. At this point in time (Dec 2005), this file contains several of the completed Monitor routines. They place calls to the existing LCD routines in the current Monitor, these .EQU equates will be shed later and the code merged into a final product. Here's the current research:
The Display The 8279 was set up originally to drive a simple display, such as a price display for a cash register, or a time-clock display. In fact, the output register is paired as OUTA0-A3, and OUTB0-B3. But it's the same 8 output bits. You can use them however you wish. But the pairing made it good to output two BCD numbers at the same time, so 8 bytes of display memory onboard could effectively drive 16 each 7-segment LED displays. The Space-Time Keyboard/Display interface does exactly that. The problem arises when you note that when using a non-encoded output for a 4x8 keyboard, you are now limited to displaying only the first 4 characters in memory (8 bits each). Now, this may seem a big sacrifice, but in my case I want to use the display to drive the 4 rows of back-lighted switches on my control panel. This way, when the user hits a switch I can "light up" that particular switch for them. Anyway, you get the idea. Well, that's about all the good news I have for now - more edits and additions when I get farther along on this part of the project. Email if you have any comments or questions.
All information contained herein that is generated by J.Owens (c) 2004, 2005. |