[ lamepage · Hardware · LCD Module · lowkal06 ]

LC-Display at the parallel port

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

Version 0.06 (28.08.2001)

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 to do this. Furthermore there is a kernel driver which can access the display in a very comfortable way. (lcd-0.152.tar.gz)
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/examples/read.pl	- Example in perl.

/driver/examples/readloop.pl	- Another example in perl.

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

/driver/lcd_module.patch2	- Patch for the driver lcd-0.152.tar.gz

/eagle/lcdkeyb_parts		- Part list for the keyboard/LED-board

/eagle/lcdmain_parts		- Part list for the mainboard

/eagle/textlcd_keyb10.sch	- Shematics for the keyboard/LED-board

/eagle/textlcd_mainb21.sch	- Shematics for the mainboard

/lcdctrl/README			- Description of lcdctrl.pl

/lcdctrl/README.isdn		- Hints for the ISDN configuration

/lcdctrl/lcdctrl.pl		- The perl program lcdctrl

/lcdctrl/lcdctrl.vars		- Configuration file for lcdctrl

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

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

/postscript/lcd_new_sym2.ps	- connection plan of the connectors/cables

/postscript/lcdkeyb10.ps	- Shematics of the keyboard/LED-board in
				  postscript format

/postscript/lcdmain21.ps	- Shematics of the mainboard in
  				  postscript format

/ppc1/ppc1.1			- manpage for ppc1

/ppc1/makefile			- Makefile for ppc1.c

/ppc1.c				- Program to control the parallel port
				  (This program is not needed, but it
				  can be used for test purposes)

The hardware

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

The complete housing Insight LCD and keys

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.

Since version 0.06 the keys and the LEDs are on an extra board, for easier assembling on a front plate. This board and the display are connected via connectors and cables with the mainboard.

Components part list:

LC-Display      - 16x2 Display with Hitachi chipset or compatible
                  (e.g. Conrad Electronic, Order-Nr.: 184594)
Housing
cables and connectors (10, 16 and 26 count)

Mainboard:

C1, C2  - capacitor 100nF
IC1     - NAND gate 74LS00 or maybe a simple transistor
IC2     - quadruple D-FlipFlop, e.g. MC14175 (CMOS) or 74LS175 (TTL)
KEYB    - connector ML10
LCD     - connector ML16
PORT    - connector ML26
R1      - 60 R
R2      - 10k
R3      - 330 R
R4      - 47k
R5      - 100k
SL1     - connecotr M02 (or solder the cable directly)
T1-T2   - transistor NPN, e.g. BC548

Keyboard:

D1-D4   - some LEDs
R6-R9   - 4.7k
R10-R13 - 330 R
S1-S4   - some keys
SV1     - connector ML10 (or solder the cable directly)

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, the keys states and the backlights I have enhanced the driver a little bit. The patch, which will do this, is included in the archive in the directory /driver.

Installation:

At thirst you should patch the driver, compile and test it. For this you have to do the following:

1. Copy the patch (lcd_module.patch2) to the source tree of the original
   driver (lcd-0.152/driver).

2. Change to that directory and enter on the command line:
   patch <lcd_module.patch2

3. Done. 
After that the driver has to be compiled. How this is done and which options you have to change, is documented in the drivers own documentation. When this is done and the driver is loaded (insmod lcd.o) you can do some tests.

To control the backlight you can use the following command:

echo -e -n "\033b\1" >/dev/lcd.

The backlight will be switched on, and

echo -e -n "\033b\0" >/dev/lcd

will switch it off.

To control the LEDs you can use:

echo -e -n "\033l\1" >dev/lcd

This switches LED 1 on, etc.

If you want to get the status of the keys, you have to read from the port /dev/lcd. Take a look at the examples in the directory /driver/examples for that.

ppc1:

The program ppc1 is from earlier days and is not necessary for normal operation. But it can be used for testing and so it is still included in the archive.
ppc1 will be build by typing "make". The documentation of this program resides in the file "/ppc1/ppc1.1" (manpage).

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

Statusport registers
Bit 7 6 5 4 3 2 1 0
occupancy BUSY *ACK PAPEREND SELIN *ERROR - - -
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
funktion LCD LCD LCD LCD LCD LCD LCD LCD
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 perl program, which provides a simple menu system 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 called lcdctrl and is included in the archive in the directory /lcdctrl.