This chapter contains the documentation of each LCDproc driver, which may include the installation process of the hardware as well as the configuration of LCDd.
There are several ways of wiring up the HD44780 devices. Your choice will probably be governed largely by your ability to wire up each one and/or a desire to use the device with other programs.
The LCDproc HD44780 driver supports the following connections on a parallel port:
4-bit
8-bit (winamp style)
extended 8-bit (LCD + LED bargraph)
serial LPT
It also supports a PIC-an-LCD connected to a serial port and the USBLCD interface.
The driver also lets you use multiple displays as a single virtual display. For example, a 4, 2 and 1 line display can be used to form a 7 line display. The number of displays is limited by the individual HD44780 driver.
No matter what connectiontype you choose, you will always need some connections. They are explaned here.
All variants use the same method of obtaining power. i.e., for each LCD:
Table 5-1. HD44780: Power Connections
LCD | pin | signal |
---|---|---|
1 | GND | (connect to any of pins 18 - 25 of you parallel port) |
2 | +5V | |
3 | Vadj | (contrast) |
Always double check your power connection, your display will probably NOT survive a reversely connected supply ! |
There are several ways to get 5V:
Connect to a 5V line intented for disk drives (the red wire is 5V, black is GND).
Get it from a joystick port (pin 1 and 9 are 5V, 4, 5 and 12 are GND). It seems that some soundcards can use these lines for communication, so if you want to use this first check wether it really gives a 'clean' 5V.
If you don't have a backlight, you can sometimes get the needed mA's from the LPT port itself. Connect a few diodes from the data pins to a capacitor and you have the 5V. If it's strong enough is another question...
Get it from the keyboard connector. I do not recommend to use this with a backlight, as the keyboard connector is often protected with a fuse of 100mA or 200mA.
You can connect a keypad with all connection types. The maximum supported number of keys differs per type. There are several ways to connect the keys to the input pins.
If you connect a key like sketched below, then you can only connect one key per input pin. It is a simple solution if you need only few keys.
Figure 5-2. HD44780: Direct Keys
O 5V | | - | | 10k | | - | +-----------o input (X) | | o \ o | | === GND
By default, the following keystrokes are generated by the different keys:
Using a matrix, we can connect much more keys. To simplify the drawing here, we replace all switches with an @ symbol:
Figure 5-3. HD44780: Single Matrix Key
X line | | Y line ---+--------- | | | o | = --@-- \ | | o | | | +---+ | |
We connect the matrix of keys like this:
Figure 5-4. HD44780: Complete Key Matrix
Y0 o---|<---@--@--@ | | | Y1 o---|<---@--@--@ | | | Y2 o---|<---@--@--@ | | | Y3 o---|<---@--@--@ O 5V | | | | diodes | | | ___ | 1N4148 +----------|___|---+ | | | ___ | | +-------|___|---+ | | | ___ | | | +----|___|---+ resistors 22k | | | o o o X0 X1 X2
As you can see, you need 1 resistor per X line, and 1 diode per Y line. Lcdproc will presume that you have a keypad with a layout like a telephone connected, with X and Y lines connected as show. To be more precise, it assumes this:
If you only need 10 keys, leave the rest away. However, the lcdproc menu is controlled by the keystrokes A to D. You should modify and recompile the driver to get an other keypad layout.
You can buy arrays of keys that are connected like this in the electronics shop. They usually call it a matrix keypad. To hook it to lcdproc, you would only need to add the resistors and diodes.
If you want to use just one return line, for example with the serialLpt wiring, it looks (completely drawn) like this:
Figure 5-6. HD44780: One Return Line
O 5V | .-. | | 4k7 or 22k diodes | | 1N4148 '-' ___ | Y0 o---|<---o o---+ ___ | Y1 o---|<---o o---+ ___ | Y2 o---|<---o o---+ ___ | Y3 o---|<---o o---+----o return line
If the driver generates keypresses without that you actually press a key, it might be that the unconnected input lines are picking up electromagnetic waves from the air. In that case connect the unconnected input lines (pin 10, 11, 12, 13 and 15 of the LPT) to VCC = 5V. |
A small extension allows you to switch the backlight of the display on and off. At the moment only the 4bit and winamp connection types support this. The extension uses one output pin, you cannot use that pin for other functions anymore. The wiring looks like this:
Figure 5-7. HD44780: Backlight Wiring
O 5V ___ | +---|___|---+ LPT Sub-D connector | 4k7 | | |e ___ | b |/ BL pin o------------|___|---+---------| 1k |\ bc327 |c | LCD connector | +--------o 15 backlight +--------o 16 GND backlight | === GND Note: 4k7 means 4,7 kohm. The BC327 transistor has the following connections: _____ | | |bc327| |_____| | | | | | | | | | c b e
Sometimes the backlight connections are not on the 'main' connector, but on the side. If that is the case, there is usually NO RESISTOR present to limit the current through the LEDs. Therefor you should then add a resistor after the transistor of about 10 ohm (see display documentation). |
If you want the backlight to light a bit while it's switched 'off', you can add a resistor bypassing the transistor from e to c, with a value of, say 47ohm or 22ohm. (My 4x20 has an internal resistor of 6ohm, so with 47 ohm extra it lights at only 1/9th. I like this. Joris.) |
This is originally based on "lcdtext" (by Matthias Prinke).
Table 5-3. HD44780: 4-bit Pinouts (1)
printer port | LCD |
---|---|
D0 (2) | D4 (11) |
D1 (3) | D5 (12) |
D2 (4) | D6 (13) |
D3 (5) | D7 (14) |
D4 (6) | RS (4) |
D5 (7) | RW (5) (LCD3 - 6) (optional - pull all LCD RW low) |
D6 (8) | EN (6) |
D7 (9) | EN2 (LCD2 - 6) (optional) |
If you want to connect more than two displays to the parallel port then wire D5 (pin 7) to the enable line (pin 6) of the third LCD. Then for displays four to seven use:
The optional keypad can be connected as follows:
Table 5-5. HD44780: 4-bit Keypad Pinouts
printer port | LCD |
---|---|
D0 (2) | Y0 |
D1 (3) | Y1 |
D2 (4) | Y2 |
D3 (5) | Y3 |
D4 (6) | Y4 |
D5 (7) | Y5 |
nSTRB (1) | Y6 |
nLF (14) | Y7 |
INIT (16) | Y8 |
nSEL (17) | Y9 |
nACK (10) | X0 |
BUSY (11) | X1 |
PAPEREND (12) | X2 |
SELIN (13) | X3 |
nFAULT (15) | X4 |
The optional backlight wiring should be connected to D5, pin 7.
This type of connection should work with winamp.
Figure 5-8. HD44780: "Winamp" wiring
printer port LCD D0 (2) D0 (7) D1 (3) D1 (8) D2 (4) D2 (9) D3 (5) D3 (10) D4 (6) D4 (11) D5 (7) D5 (12) D6 (8) D6 (13) D7 (9) D7 (14) nSTRB (1) EN (6) nLF (14) nRW (5) (EN3 6 - LCD 3) (optional) INIT (16) RS (4) nSEL (17) EN2 (6 - LCD 2) (optional)
If you want the display to work with the Winamp plugin, wire nLF (pin 14) to nRW of your LCD. You can then use the plugin in bidirectional mode (wich is much faster). With 3 connected LCDs this is not possible. Note from Benjamin: I haven't tried using winamp while having the third LCD connected to this line.
The optional keypad can be connected as follows:
Figure 5-9. HD44780: "Winamp" wiring - Keypad
printer port keypad D0 (2) Y0 D1 (3) Y1 D2 (4) Y2 D3 (5) Y3 D4 (6) Y4 D5 (7) Y5 D6 (8) Y6 D7 (9) Y7 nLF (14) Y8 INIT (16) Y9 nACK (10) X0 BUSY (11) X1 PAPEREND (12) X2 SELIN (13) X3 nFAULT (15) X4
The optional backlight wiring should be connected to nSEL, pin 17.
This is originally based on "lcdtime" (by Benjamin Tse
<blt@ComPorts.com>
) and allows you to combine the LCD with a LED
bargraph. The LCD is driven by LCDproc and the LEDs by another program
such as portato. Further details can be obtained from:
http://metalab.unc.edu/pub/linux/system/status/lcdtime-0.2.tar.gz http://metalab.unc.edu/pub/linux/system/status/meter-0.2.tar.gz http://metalab.unc.edu/pub/linux/system/status/portato-1.2.tar.gz
Theoretically this wiring sends the data over twice as slow as the winamp or ext8bit wirings, because it only sends 4 bits at a time. |
The LCD connections are:
Figure 5-10. HD44780: "lcdtime" wiring
printer port LCD D0 (2) D0 (7) D1 (3) D1 (8) D2 (4) D2 (9) D3 (5) D3 (10) D4 (6) D4 (11) D5 (7) D5 (12) D6 (8) D6 (13) D7 (9) D7 (14) nSEL (17) - nSTRB (1) RS (4) nLF (14) RW (5) (LCD2 - 6) (optional - pull all LCD RW low) INIT (16) EN (6)
See the lcdtime tar-ball (above) for full details of the bargraph connections.
The optional keypad can be connected as follows:
Figure 5-11. HD44780: "lcdtime" wiring - keypad
printer port keypad D0 (2) Y0 D1 (3) Y1 D2 (4) Y2 D3 (5) Y3 D4 (6) Y4 D5 (7) Y5 D6 (8) Y6 D7 (9) Y7 nSTRB (1) Y8 nSEL (17) Y9 nACK (10) X0 BUSY (11) X1 PAPEREND (12) X2 SELIN (13) X3 nFAULT (15) X4
The backlight wiring should be attached to nSEL, pin 17. Because the portato program (mentioned above) also uses this pin to control the bargraph, you cannot use the backlight control together with the bargraph.
This interface uses a handful of wires to interface to the
HD44780. Suitable for high noise, long connections. Designed by
Andrew McMeikan <andrewm@engineer.com>
. The original wiring and
driver can be found at:
http://members.xoom.com/andrewmuck
I (Joris) have extended this driver and the wiring a bit. It now supports keys again (it had earlier supported keys, but some time did not).
Further I have extended the driver and the wiring to be able to run using 2 instead of 3 output pins. That's even one less pin ! :)
Of course the use of fewer lines than the other wirings can not stay without drawbacks. In this case the simplicity of the long feeding wires is compensated by some intelligence in the decoding of the data. If you have no experience with the soldering iron, I do not recommend to build this wiring.
OK, so here is the wiring. First of the 'simple' 3 wires version. IC1 is the shift register, a 4094. Do not forget to connect the 5V to pin 16 and GND to pin 8 of the IC.
Figure 5-12. HD44780: Serial LPT wiring ('simple')
IC1 ----------- | 4094 | 5V | shift reg | display O | | keys | 1| |4 +----|STR Q0|--------------------o 11 D4 Y0 | | |5 Data | 2| Q1|--------------------o 12 D5 Y1 D3 5 o-------------------------|D |6 | | Q2|--------------------o 13 D6 Y2 | 3| |7 D4 6 o-------------------------|CK Q3|--------------------o 14 D7 Y3 | | |14 | 15| Q4|--------------------o Y4 +----|OE |13 | Q5|--------------------o 4 RS Y5 | |12 | Q6|--------------------o Y6 | |11 | Q7|--------------------o Y7 | |9 | QS|-- +--o 5 RW | __|10 | | QS|-- === | | ----------- D2 4 o----------------------------------------------------------o 6 EN D7 9 o----------------------------------------------------------o 6 EN2 (2nd LCD) 5V O-----+--------+-------------------------------+-----o 2 VCC | | | | | | |100n O 16 .-. --- IC1 | |<---o 3 Vlcd --- O 8 | |10k | | '-' GND | | | 18..25 o-----------+--------+-----------------------+-------+-----o 1 GND | === GND
The second possible wiring is with 2 output lines. This one is a bit more complex. If you do not understand the schematic, do not build it.
Figure 5-13. HD44780: Serial LPT wiring ('complex')
IC2 ----------- | 74HCT164 | | shift reg | display | | keys Data 1| |3 D3 5 o---------------------+---|D Q0|--------------------o 11 D4 Y0 | | |4 | 2| Q1|--------------------o 12 D5 Y1 +---|D |5 | Q2|--------------------o 13 D6 Y2 | |6 | Q3|--------------------o 14 D7 Y3 | |10 Clock 8| Q4|--------------------o Y4 D4 6 o-------------------------|CK |11 | Q5|--------------------o 4 RS Y5 ___ 9|\ 8 9|_ |12 +--|___|--+----| >o----|R Q6|--------------------o Y6 | 22k | |/ | |13 | --- IC1 | Q7|---+ +--o 5 RW | --- | | | 5V | | |100p ----------- | O === | | | | | === | .-. | | | |22k +--------------------------------------+ | | | '-' | ___ 11|\ 10 | 5|\ 6 +--|___|--+----| >o-------------------||-----+----| >o--o 6 EN 22k | |/ 22p |/ --- IC1 IC1 --- |22p | IC1=74HCT14 (6x Schmitt trigger inverter) === 5V O--+-------+------+------+-----------------------+-----o 2 VCC | | | | 13|\ 12 | | | | +---| >o- | |100n O 14 O 14 |/ .-. --- IC1 IC2 | |<---o 3 Vlcd --- O 7 O 7 1|\ 2 3|\ 4 | |10k | | | +--| >o- +--| >o- '-' GND | | | | |/ | |/ | 18..25 o------+-------+------+-------+----------+-----+-----+-----o 1 GND | === GND
To understand this part of the serialLpt documentation, you also need to read the keypad section in this document. |
serialLpt wiring supports a keypad. The 3 wires version supports 8 keys, or if you use multiple return lines up to 8 x 5 = 40 lines. The 2 wires version supports 7 keys, or with multiple return lines 7 x 5 = 35 keys.
Figure 5-14. HD44780: Serial LPT - Keypad return lines
nACK (10) X0 BUSY (11) X1 PAPEREND (12) X2 SELIN (13) X3 nFAULT (15) X4
On lines longer than, say a meter, you should buffer the return line(s). If you only have 1 return line, you can buffer it with two remaining buffers from the 74HCT14:
Also a backlight is suported. You will also need a port from the 74HCT14 for that. The BL output below should be connected to the BL input in the backlight section
The PIC-an-LCD module is also supported. It is not connected to the LPT port but to a serial port, which saves you from a lot of potential problems. To use it, specify the device to which you have connected the module in the config file with the Device= setting. The default is /dev/lcd. It does not support a keypad nor backlight switching.
The USBLCD Interface lets you use HD44780 compatible LCDs via the USB port. Make sure you have the USBLCD kernel module installed and loaded, since 2.4.20 it is part of the Linux Kernel or can be downloaded from www.usblcd.de. If you want to use another device file then the default "/dev/usb/lcd" you can specify this with the "Device=" option in the config file. It is also recommended to set "Backlight=yes" and "Keypad=no".
Make sure that the HD44780 files are built when you run configure. This can be done by specifying "--enable-drivers=all" or by "--enable-drivers=hd44780".
Since LCDproc 0.4.3 the HD44780 driver can be configured from the configfile (LCDd.conf).
The [HD44780] section is more or less self-explanatory. Yet, a list of the possible connection types has proved useful. The following table should make it clear, how the ConnectionType is to be set.
Table 5-6. HD44780: Connection Types
Wiring / Display Type | ConnectionType= |
---|---|
HD44780 4bit Wiring | 4bit |
HD44780 8bit Wiring ("lcdtime") | 8bit |
HD44780 Serial LPT Wiring | serialLpt |
HD44780 8bit Wiring "winamp" Style | winamp |
PIC-an-LCD serial device "picanlcd" | picanlcd |
USBLCD Interface | usblcd |
The above table might be outdated, when you read this. If you suspect this is the case, you might want to have a look at server/drivers/hd44780-drivers.h which contains the actual translation code. |
Modify the LCDd.conf file before you run LCDd. In this config file are detailed instructions on how to configure the HD44780 driver.
Then as usual, start LCDd with the correct config file:
E.g. LCDd -c ./LCDd.conf
If you want to override the driver selection in LCDd.conf then use:
LCDd -c ./LCDd.conf -d HD44780
If you use this, the HD44780 driver will read the options from the config file anyway.
It will show lines filled with blocks. The position of these lines will depend on the LCD size. A 2x20 will fill the first line, a 4x20 will fill the first and third lines and a 2x40 will fill the first line on both halfs on the LCD.
The fact of being properly connected won't affect the content of the display. So it should be lines filled with blocks like in the precending question.
Once initialised, the HD44780 will go blank, then show what it receives from LCDproc. Generaly it will be something like "Clients: 0 Screens: 0".
They should all work. We are only using the features of the SPP (normal) type, so set it to this if in doubt.
5.1.5.5. What is the difference between numerous connection variants and which one is the best, simplest or most compatible.
There's no real answer to that, if there was a real better connection type we would only use this one. Connections using 8 bits are twice as fast as the one using 4 bits. The winamp connection is compatible with the WinAmp plugin.
This text has originally been taken from a message by Bill Farrow
<bfarrow@arrow.bsee.swin.edu.au>
.
Updated February 2000, Benjamin Tse <blt@ComPorts.com>
Updated October 2001, Joris Robijn <joris@robijn.net>
Converted to docbook March 2002, Rene Wagner <reenoo@gmx.de>
Updated April 2002, Rene Wagner <reenoo@gmx.de>
Added the Q&A September 2002, Guillaume Filion <gfk@logidac.com>