Files
lcdproc/docs/hd44780_howto.txt
T

384 lines
9.4 KiB
Plaintext

HD44780 HOWTO
-------------
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
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.
1. Connections
--------------
1.1 Common connections for all connectiontypes
-----------------------------------------------
No matter what connectiontype you choose, you will always need some
connections. They are explaned here.
1.1.1 Power
------------
All variants use the same method of obtaining power. i.e., for each LCD:
LCD pin signal
1 GND (connect to any of pins 18 - 25 of you parallel port)
2 +5V
3 Vadj (contrast)
WARNING: Always double check your power connection, your display probably
wont 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.
Connecting the contrast adjusting pin (Vadj.):
(variable resistor)
.------.
Vcc ---| 10k |--- GND
`---^--'
/|\
|
Vadj.
1.1.2 Keypad
-------------
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.
1.1.2.1 Direct keys
--------------------
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.
+ 5V
|
|
-
| | 10k
| |
-
|
+-----------o input (X)
|
|
o
\
o
|
|
=== GND
By default, the following keystrokes are generated by the different keys:
X0 A
X1 B
X2 C
X3 D
X4 E
You should modify and recompile the driver to get other keystrokes.
1.1.2.2 Matrix keys
--------------------
Using a matrix, we can connect much more keys. To simplify the drawing here,
we replace all switches with an @ symbol:
X line
|
|
Y line ---+---------
| | |
o | = --@--
\ | |
o |
| |
+---+
|
|
We connect the matrix of keys like this:
Y0 o---|<---@--@--@
| | |
Y1 o---|<---@--@--@
| | |
Y2 o---|<---@--@--@
| | |
Y3 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:
X0 X1 X2 X3
Y0 1 2 3 A
Y1 4 5 6 B
Y2 7 8 9 C
Y3 * 0 # D
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.
1.2 4-bit
----------
This is originally based on "lcdtext" (by Matthias Prinke).
The pinouts are:
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:
printer port LCD
STR (1) EN4
LF (14) EN5
INIT (16) EN6
SEL (17) EN7
The optional keypad can be connected as follows:
printer port keypad
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
1.3 8-bit "Winamp"
-------------------
This type of connection should work with winamp.
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:
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
1.4 Extended 8-bit "lcdtime"
-----------------------------
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
The LCD connections are:
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:
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
1.5 Serial LPT
---------------
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>. Refer to
http://members.xoom.com/andrewmuck for details of the connections.
Note from Joris: I still need to add keypad stuff here
2. Compiling
------------
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".
3. Running
----------
Keep in mind the following points.
- When specifying the lcd size, do so before the -d argument.
- Arguments that need to be passed to the driver should be in quotes after
the -d HD44780 arguments.
- Use the "-e" argument for extended interfaces (e.g. 3 or more displays as
indicated by "optional" connections above).
- Use "-k" to enable the keypad code.
EXAMPLES:
For a 4bit connection, 16x2 display on port 0x278
LCDd -t 16x2 -d HD44780 "-p 0x278"
For a 4bit, 40x4 display (effectively two 40x2 displays)
LCDd -t 40x4 -d HD44780 "-v 2,2"
For a Winamp connection, 20x2 and 20x1 displays
LCDd -t 20x3 -d HD44780 "-c winamp -v 2,1"
For a 4bit, 16x2, 16x4 and 16x1 displays
LCDd -t 16x7 -d HD44780 "-v 2,4,1 -e"
For help on the parameters for the 8-bit driver (make sure --help is the
last arguments in quotes):
LCDd -d HD44780 "-c 8bit --help"
4. Miscellania
---------------
This text originally taken from a message by Bill Farrow
<bfarrow@arrow.bsee.swin.edu.au>.
Updated February 2000, Benjamin Tse (blt@ComPorts.com)