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").


The original Space-Time Productions keypad / display.
Click on image for larger.


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.
The old panel...
The original panel.

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:

  • To put the focus of the computer's control at its own front panel.
  • To reduce and eventually remove the Z-80's dependency on an attached TTY terminal or PC "Hyperterminal" hookup.

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:

  • 36 Orange push-button/indicators
  • 9 Green indicators
  • 9 Red indicators


I also have a big rocker switch that came in a box of parts I got as a parting gift for my 18 years of work in the Biomedical field, which was a spare part for an Amsco Instrument Sterilizer. It's a beauty. The original power switch has always been on the back of the cabinet, and it's a pain to reach back there to turn it on and off. So my new design brings the power forward to the front of the machine where it belongs.

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.
Click HERE to see the CAD graphic.

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
After all hope has been lost, and I have spent weeks pining for my poor lost aluminum panel. One morning late October I come in to find the blank panel lying in my chair at work. It is a thing of great beauty to me, has metal burrs hanging off of many switch holes. He tells me that I'm going to have to hand-file each hole, since the corners are rounded by the cutting process, my switches are perfectly square. Over the course of several evenings after the kids went to bed, I filed them out, one by one, and sure enough the switches pop in smooth as silk.

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.

Now, I have to be totally honest and up-front - it was a huge temptation to just leave the shiny aluminum as the finish. I mean, it looked incredible and the gray switches looked good against it. I was trying to think of something to coat in with to preserve that shine. And then I remembered that I had sent my dear sweet Teresa to Walmart 15 miles away in Abilene to grab the primer and flat black paint for me. So, I used my best judgement - and started priming the surface gray.

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.

Click for larger

Click for larger

This is the keyboard inserts transparency.

In addition to the 32 keys + shift and control, I also have 8 indicator lamps tied to I/O port $68 of the 8255. This is actually a left-over from the first panel which had 8 small green LED's tied to this port that I could used to rotate bits back and forth and other such nonsense. I decided since I had the indicators it would be useful in diagnosing things (e.g. echo the status of an input port over to $68 to see when a bit, switch, or status bit makes a transition). Since I didn't want green indicators with just "7" and "0" on them, I decided that during normal monitor functions, they could be used to show what command is in progress. This makes sense, and provides a little eye-candy for the user while also giving the D7 thru D0 bit numbers for quick conversion to hex, octal, etc.

[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:

  • Installed all the hardware and interface.
  • Created Monitor with RST's including the 8279.
  • Started coding the new Monitor using 8279 and LCD, move Stack and params up to $4010-$42FF.

Still left to do:

  • Complete and test the new Monitor Rom.
  • Order in a new ULN2803 8 output driver for TTL (I accidentally got a ULN2804 for CMOS...)
  • Modify BASIC so that it can print to both Hyperterminal and the LCD by setting bits in the IOFLAG byte.
  • Replace the static ram at $3000-$3FFF with a 2732 Eprom.

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
Once again, here is the original 8279 software Monitor for this board, if you are interested in reading all my hash marks.

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:

  • The key by itself
  • Shift + the key
  • Control + the key
  • Shift + Control + the 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:

  • D7 - Control key - "1" when pin is open, switch must close to GND
  • D6 - Shift key - "1" when pin is open, switch must close to GND
  • D5, D4, D3 - is the SL # [000,001,010,011]
  • D2, D1, D0 - is the three-bit representation of the column of the key 0-7

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:
LD D,$00
LD E,A
ADD HL,DE
and this will set HL to the new vector. Then execute a JP to this vector by PUSHing HL and then RETurning, and the command is complete. Here is the key value table following the code:

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:
While the main input key lines to the 8279 are pulled high, they depend upon the SLn lines to provide the ground for each particular row. The Shift and Control keys are pulled high interally also. This means they must be connected as Normally-Closed switches to ground. When the key is depressed, it should open, and allow the 8279 to pull the bit high. This is probably in strong contrast to the other switches you are using. Fortunately, my keys provide both N.C. and N.O. contacts for just such a thing. - If this is a problem, you may simply wish to invert these bits in software, or to build your keyboard function table such that Shift and Control are assumed to be normally high when not engaged.


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:

TEST.ASM


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.
Other information credited to its sources.
This Site is not affiliated with Space-Time Productions, Mr. M.Simon, or Mr. Ron Weiss, however I extend a grateful Thanks to those parties.
This site has a sole purpose to provide technical information, and is not intended to infringe any prior
copyrights nor to derive funds that would otherwise be the property of Microsoft, Space-Time Productions
or it affiliates, either past or present.
May the Farce be with you.