[ lamepage · Hardware · LCD Module · lowkal ]

LC-Display at the parallel port

Project name: lowkal - [L]CD C[o]ntrol [w]ith [K]eys [a]nd [L]EDs

What is LOWKAL?

There are more projects to connect a LC-display to the parallel port of an IBM compatible Computer. For example on http://www.home.unix-ag.org/nils/lcd.html is a guide from Nils Faerber und Michael Engel to do this. Furthermore there is a kernel driver which can access the display in a very comfortable way.
The enhancements here on this page refers to the project above. In this way, there are four keys and four LEDs which will be added to the port. The keys can be added in a very simple way; at the parallel port are some free status lines, which will be used for that. The LEDs will be connected to the lower four data lines. To control them independent from the display, a D-FlipFlop, triggered by *RESET, will be used.

What do I need?

Files in the archive:

/COPYING			- The GNU Genaral Public License

/LIESMICH			- This text in german

/README				- This text here

/driver/README.patch		- Changes on lcd_module.c, the kernel driver

/driver/lcd_module.patch	- patch

/init.d/lcd			- start/stop script

/ppc1/ppc1.1			- manpage for ppc1

/ppc1/makefile			- Makefile for ppc1.c

/ppc1.c				- Program to control the parallel port
				  (to get the key states and to control 
				   the LEDs)

/ps/lcd1_sym2.ps		- connection plan of some components

/ps/lcd3_shema.ps		- shematics of the complete LCD Module

/ps/lcd_dimensions.ps		- dimensions of the Conrad-display (16x2)

/tcl/README			- short description of lcdt1.tcl

/tcl/lcdt1.tcl			- tcl-script to control the LCD, the LEDs and
				  to get the key-states using ppc1. Furthermore
				  a simple menu system to get states of incoming
				  mail, vbox messages and so on.

The hardware

At first here the pictures from the kompleted module, the shematics etc.:

LCD Vorderseite
LCD Rückseite
connection plan
dimensions of the display

The display will be wired as described in the shematics. Please notice, that pin 6 (enable) must be connected to *STROBE and pin 4 (rs) to *FEED, because the kernel driver controls these lines. Pin 5 (r/w) will be connected to ground, because we never will read from the display, only write to. The contrast can be adjusted by the voltage divider R2 and R3. The values of these resistors depends on the type of the display, so if you have some other display, you have to try them out.
The backlight (if available) will be controled by the *SELECT line using the two transistors T1 and T2. Where T2 is only used as an inverter. As I ascertained in the past, the *SELECT line defaults to LOW. So, if you want, you can resign of T2 and connect the line directly (over R5) to T1. The baseresistor R4 has to be omitted then.

To the keys, there is nothing much to say. The pullup resistors R6, R7, R8, R9 pull up (as the word says) the status lines (*ERROR, SelIN, PaperEnd, *ACK) to HIGH potential. If a key is pressed, it will pull down the corresponding line to LOW. According to this, the value of the status register will change.

The control of the LEDs is a little bit more complicated. To control them independent of the display, a D-FlipFlop (IC2, MC14175) will be used. The FlipFlop itself will be controled by the inverted (IC1) *RESET line. On positve signal pulse at the clock input of IC2, the data on the input will be latched to the output. So the software has to take care about valid data on the data lines, and then pull down the *RESET line to LOW (HIGH on clock). The inverter (IC1) is a simple NAND gate (74LS00), but you may use a simple transistor instead.

The LEDs will be controled by the FlipFlop over IC3 (4066). In dependence of the used FlipFlop, the LEDs may be driven by it directly. For example a TTL 74LS175 should have the ability to drive the LEDs directly. But make sure that the resistors have to change, so that the LED current can't rise over 10mA. And please have a closer look to the datasheet of your favorite FlipFlop.

Note: You see, there are more possibilities to create a functional hardware. So keep in mind, that my concept here is only an experimental work.

Components part list:

LCD1	- display with Hitachi chipset or compatible
	  (e.g. Conrad Electronic, Order-No. 184594)
IC1	- NAND gate 74LS00 or maybe a simple transistor
IC2	- quadruple D-FlipFlop, e.g. MC14175 (CMOS) or 74LS175 (TTL)
IC3	- quadruple switch 4066 (CMOS)
T1-T2	- transistor NPN, e.g. BC548
SW1-SW4	- some keys
LED1-4	- some LEDs
C1-C3	- capacitor 100nF
R1	- 60 R
R2	- 10k
R3	- 330 R
R4	- 47k
R5	- 100k
R6-R9	- 4.7k
R10-R13	- 330 R

The Software

The most important thing of the software is ther kernel driver lcd.o, which you can get from http://www.home.unix-ag.org/nils/lcd.html. It is completely responsible for the communication with the display.
For the control of the LEDs and the key states I wrote a tiny program, which will do the job. It would be nicer, to have these things in a kernel driver, but my programming experience is too insufficient for this.
More information about the kernel driver (lcd-0.13.tar.gz) you can get from the website mentioned above and at the documentation in it's archive.


At thirst you should patch the driver, compile and test it. The patch is necessary for the backlight independent control of the display. The orignal driver doesn't hurt on the bit for the *SELECT line, so at every write access the backlight may be switched on. To avoid this, the patch is needed. See the file "/driver/README.patch" for details on this. For installing the patched driver see it's own documentation.

The program ppc1 will be build by typing "make". The documentation of this program resides in the file "/ppc1/ppc1.1" (manpage). With ppc1 you have the ability to control the LEDs and to get the status of the keys. The only problem is, that ppc1 will display the status only once, when it is called. For continuous query of the keys you have to run it again and again. Thats not really good, I know, but for now there is no other solution. See also at lcdt1.tcl below, how this may be handled.

Now, here is an overview about the parallel port registers and how they will be used: (It may helpfull for the usage of ppc1)

Statusport registers
Bit 7 6 5 4 3 2 1 0
function - key 4 key 3 key 2 key 1 - - -

Controlport registers
Bit 7 6 5 4 3 2 1 0
occupancy - - ExtModeDir IRQ *SELECT *RESET *FEED *STROBE
function - - I/O - backlight latch LCD LCD

Dataport registers
Bit 7 6 5 4 3 2 1 0
occupancy DATA 7 DATA 6 DATA 5 DATA 4 DATA 3 DATA 2 DATA 1 DATA 0
function - - - - LED 4 LED 3 LED 2 LED 1

More possibilities

And now? What should it be for you ask? Okay, for example I've written a tcl program, which contains a simple menu system, gets the key states using ppc1 and controls the LEDs depending on various events.
The functions are: vbox check (ISDN answering machine), mail status display, server load, uptime and so on. This program is working for me since a long time on my private server. Sure, there are still some problems and bugs, but I'm satisfied with it. (BTW: server uptime is about 158 days)

This program is called lcdt1.tcl and is included in the archive. Furthermore where is a start/stop script for the init.d directory.
I'm sorry to say, but until now I didn't managed to write a tidy documentation for lcdt1.tcl (no time, no motivation). And the most important thing is, this program is not already finished and has many evil bugs, too. So it may mostly be an incitement for people, who have expierence with tcl.