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
Good luck with your custom character set! Send your photos so I can see what you've done.