Z80 Space-Time Productions Single Board Computer

Technical Support Information - LCD Display


HD44780U 2x40 LCD Display


Interface Schematic for LCD

Here's the schematic (this is an excerpt of Sheet 5 of the schematics I have drawn at the top of this page). All the connections you see at the left are made to the 24-pin wire-wrap socket of IC-17; these are the same as the AMD9511/12 Mathbox IC, with the exception of pin 6 (normally unused) which now takes -12V up to the interface circuit board. You will have to add this wire-wrap to the bottom of your Space-Time Productions SBC board. -12Vdc is available on J-2 for the RS-232 adapter.

The Finished Interface PCB


Here's a picture of the completed LCD interface, with the ribbon cable detached for clarity. This pcb 'floats' above the IC-17 socket about 1" off the main pcb.
I added a 74LS374 data latch which captures any data to or from the LCD display and puts in on the LED's to the right. This way, I can see if there is traffic there.
They all glow dimly when the Z-80 and the LCD are negotiating.


Initializing the LCD Interface from Assembly Language


Research Discussion

This is the final design I came up with to provide the LCD drive voltage, the data bus buffer (since the data bus is essentially being sent down a long ribbon cable to the LCD), the 74LS175 "timing chain" shift register, and signal buffers (using 74LS14 Schottky inverters). I built this using a 24-pin wire-wrap socket to lift the interface PCB away from the main Space-Time Productions pcb - soldering only the tips of the socket to the pcb. The connections to the other IC's are made using bits of wire-wrap wire soldered to the other IC sockets. I had to do this instead of using full length wire-wrap sockets for the other IC's since the interface board rests over several IC's on the main board. The length of the other pins would have created a space contention problem. To my happy surprise, this works great. I can now directly write to and query the LCD by way of:

  • IN A,($7C) - to read the cursor position and Busy Flag status bit (D7)
  • IN A,($7D) - to read the contents of CGRAM or character in DDRAM at the current cursor location
  • OUT ($7C),A - to write a control word out to the LCD
  • OUT ($7D),A - to write a character to the display or byte to the CGRAM

The old method, using two ports off the 8255, required that I first write my ASCII character or command word to port $89, then write a word out to port $8A that would set the appropriate bits for the Register Select RS and toggle the enable E high, then write another word that would toggle it low again.

This was very time consuming, and in fact I found that this tedious programming method was actually causing me to NOT use the LCD display at all when in fact it would have been nice for some programs. This also makes it easy to pass strings to the LCD by way of BASIC program as well. I have found that since I built this interface, it has been very easy to add the few lines of code to existing programs I have that now allow the user to operate the test totally without the use of the terminal program running on an adjacent PC.

Early in this project (early 2002) I had acquired a 2x40 LCD display using a true HD44780U controller. This once belonged on a ECG machine called a MacVue, but the attached keypad had some failed keys, so I ended up with the parts for salvage. I used a hacksaw to separate the keypad part of the bezel away from the LCD mount, and installed the remaining portion on the front panel of my rack-mount cabinet.

The problem with it was it was only a reflective strip type of LCD, which is fine when the user is looking straight down into it with room lighting. If it is mounted vertically, it is nearly impossible to read. So I began searching various places for a nice, backlit display with the same type controller. I nearly bought a Simplex Fire Alarm panel at Gillen's Army Surplus in Lampases, Texas, but I was afraid it would be pretty pricey for the one display that I needed out of this huge cabinet. One of the many fine electronic geeks that I met by way of this web site put me in touch with BG Micro Electronics. They have a 2x40 LCD along with it's interface panel. I bought it for a whole $6.00 + $4.00 s/h.

I found out very quickly that this is not a one-for-one replacement to the LCD that I had before. The problem is in the contrast control (pin 3). On the original, non-backlit display, this was supposed to be hooked to the wiper of a 10K pot between +5 and ground, most websites said just to tie it to ground and it would work (sure enough). The new one I got from BG Micro uses a negative bias voltage on the glass to control the contrast. Tying a potentiometer wiper to this pin does not provide enough current to drive the glass.

My next experiment was to use an op amp to drive the contrast (glass) at pin 3, tied it's inverting input to the output of the op amp, and created a 30k voltage divider string using two 10K resistors and a 10K pot between +12V and -12V. The wiper of this pot is tied to the non-inverting input. This op amp provides enough current to drive the glass just fine. I found that -2.00Vdc was the optimum setting, but you could adjust it between -0.5V (text invisible) to -3.0V (all segments dark regardless of on/off state).

After a short conversation with BG Micro, I decided to draw the schematic for my interface and post it to my site. This is part of the schematic package I included at the top of this page, but the interface portion is included below.

The Z-80 I/O timing and the HD44780U are not compatible, there are a number of timing problems. My original LCD display was tied to ports $69 and $6A to write the data and to pulse the E and RS select pins. This was a terrible waste of 8255 ports, so I went searching for a fix. I tried several delay circuits of my own that didn't work too great, but I ended up borrowing this ingenious 74LS175 timing circuit design from Wilf Rigter.

He has written a good article on the theory of timing the HD44780U LCD Controller IC, and interface to the ZX80 computer. His article appears here:
http://www.user.dccnet.com/wrigter/index_files%5CZXLCD.htm
[Let me know if this link goes dead at some point.]


How I created a Space:1999 Eagle for my LCD Display

I'm a big fan of the vintage TV show Space:1999 . I think their spacecraft, the EAGLE is still unmatched in all of science fiction to date. I was trying to figure out something productive to do with those darn custom characters on the LCD display. I wanted an arrow pointer, so I set the last custom character to that one, but characters 0 thru 6 I decided to use to create one image - the EAGLE. Here's how I came up with the bitmap pattern for it.

  • Step 1 - Take a side-shot of the Eagle, resize it to 5x7 by 7 characters (35x7 pixels). Convert it to 16 color GIF format
  • Step 2 - Convert it to a very tight pixel pattern so it conforms to the 5x7 pixel character format. I added the gray bars to show the small physical spaces between the characters on the LCD. This caused a resize to 40x7 pixels.
  • Step 3 - Enlarge the whole graphic so it is big enough to visualize the individual bits. At first I tried making the Eagle parts "0"'s and the background "1"'s.
  • Step 4 - When I programmed it in, it didn't look too great, so I went back and inverted all the colors.
    This gave me something that I could convert to individual bits. Each bit pattern formed a byte that must be written into the LCD's CGRAM area.
  • Step 5 - Just for fun, I set the color table where it would look more like what you'd see on the screen when the product was finished!

The Finished Product


Click on the pic to see a larger shot.

The Bitmap Codes

There is a small piece of code that you have to run to load these bit patterns into the CGRAM area of the LCD's memory. Once they are loaded, all you have to do is to print a character with a value of $00 thru $07 to see your custom characters.

As you can see from the photo of the LCD, I've altered the code slightly to correct the engines from the original design. They look o.k. either way, but I just liked them better as in the finished product.

Good luck with your custom character set! Send your photos so I can see what you've done.


Click HERE if you do not see a menu frame to the left.

This page created January 28, 2006.

All information contained herein that is generated by J.Owens ©2006.
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 Schwartz be with you.