Modified the HD44780 driver to work with keypad.
This commit is contained in:
+248
-58
@@ -21,21 +21,39 @@ HD44780 driver.
|
|||||||
1. Connections
|
1. Connections
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
1.1 Power
|
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:
|
All variants use the same method of obtaining power. i.e., for each LCD:
|
||||||
|
|
||||||
LCD pin signal
|
LCD pin signal
|
||||||
1 GND (connect to any of pins 18 - 25 of you parallel port)
|
1 GND (connect to any of pins 18 - 25 of you parallel port)
|
||||||
2 +5V
|
2 +5V
|
||||||
3 Vadj (contrast)
|
3 Vadj (contrast)
|
||||||
|
|
||||||
Getting the supply voltage:
|
WARNING: Always double check your power connection, your display probably
|
||||||
Use a floppy supply connector, get it from the game port, take some
|
wont survive a reversely connected supply !
|
||||||
diodes and a capacitor and get it from the port's data lines, get it
|
|
||||||
from the keyboard connector or whatever you like. Be safe to avoid
|
There are several ways to get 5V:
|
||||||
a short circuit. Most non-backlit displays only need 3mA at 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.):
|
Connecting the contrast adjusting pin (Vadj.):
|
||||||
|
|
||||||
@@ -47,6 +65,110 @@ Connecting the contrast adjusting pin (Vadj.):
|
|||||||
|
|
|
|
||||||
Vadj.
|
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
|
1.2 4-bit
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@@ -54,56 +176,100 @@ This is originally based on "lcdtext" (by Matthias Prinke).
|
|||||||
|
|
||||||
The pinouts are:
|
The pinouts are:
|
||||||
|
|
||||||
printer port LCD
|
printer port LCD
|
||||||
|
|
||||||
D0 (2) D4 (11)
|
D0 (2) D4 (11)
|
||||||
D1 (3) D5 (12)
|
D1 (3) D5 (12)
|
||||||
D2 (4) D6 (13)
|
D2 (4) D6 (13)
|
||||||
D3 (5) D7 (14)
|
D3 (5) D7 (14)
|
||||||
D4 (6) RS (4)
|
D4 (6) RS (4)
|
||||||
D5 (7) RW (5) (LCD3 - 6) (optional - pull all LCD RW low)
|
D5 (7) RW (5) (LCD3 - 6) (optional - pull all LCD RW low)
|
||||||
D6 (8) EN (6)
|
D6 (8) EN (6)
|
||||||
D7 (9) EN2 (LCD2 - 6) (optional)
|
D7 (9) EN2 (LCD2 - 6) (optional)
|
||||||
|
|
||||||
If you want to connect more than two displays to the parallel port then
|
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
|
wire D5 (pin 7) to the enable line (pin 6) of the third LCD. Then for
|
||||||
displays four to seven use:
|
displays four to seven use:
|
||||||
|
|
||||||
printer port LCD
|
printer port LCD
|
||||||
|
|
||||||
STR (1) EN4
|
STR (1) EN4
|
||||||
LF (14) EN5
|
LF (14) EN5
|
||||||
INIT (16) EN6
|
INIT (16) EN6
|
||||||
SEL (17) EN7
|
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
|
1.3 8-bit "Winamp"
|
||||||
----------
|
-------------------
|
||||||
|
|
||||||
This type of connection should work with winamp.
|
This type of connection should work with winamp.
|
||||||
|
|
||||||
printer port LCD
|
printer port LCD
|
||||||
|
|
||||||
D0 (2) D0 (7)
|
D0 (2) D0 (7)
|
||||||
D1 (3) D1 (8)
|
D1 (3) D1 (8)
|
||||||
D2 (4) D2 (9)
|
D2 (4) D2 (9)
|
||||||
D3 (5) D3 (10)
|
D3 (5) D3 (10)
|
||||||
D4 (6) D4 (11)
|
D4 (6) D4 (11)
|
||||||
D5 (7) D5 (12)
|
D5 (7) D5 (12)
|
||||||
D6 (8) D6 (13)
|
D6 (8) D6 (13)
|
||||||
D7 (9) D7 (14)
|
D7 (9) D7 (14)
|
||||||
nSTRB (1) EN (6)
|
nSTRB (1) EN (6)
|
||||||
nLF (14) nRW (5) (EN3 6 - LCD 3) (optional)
|
nLF (14) nRW (5) (EN3 6 - LCD 3) (optional)
|
||||||
INIT (16) RS (4)
|
INIT (16) RS (4)
|
||||||
nSEL (17) EN2 (6 - LCD 2) (optional)
|
nSEL (17) EN2 (6 - LCD 2) (optional)
|
||||||
|
|
||||||
If you only want one display, wire nLF (pin 14) to nRW of your LCD.
|
If you want the display to work with the Winamp plugin, wire nLF (pin 14)
|
||||||
N.B. I haven't tried using winamp while having the third LCD connected
|
to nRW of your LCD. You can then use the plugin in bidirectional mode (wich
|
||||||
to this line.
|
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
|
1.4 Extended 8-bit "lcdtime"
|
||||||
-------------------
|
-----------------------------
|
||||||
|
|
||||||
This is originally based on "lcdtime" (by Benjamin Tse
|
This is originally based on "lcdtime" (by Benjamin Tse
|
||||||
<blt@ComPorts.com>) and allows you to combine the LCD with a LED
|
<blt@ComPorts.com>) and allows you to combine the LCD with a LED
|
||||||
@@ -116,24 +282,45 @@ http://metalab.unc.edu/pub/linux/system/status/portato-1.2.tar.gz
|
|||||||
|
|
||||||
The LCD connections are:
|
The LCD connections are:
|
||||||
|
|
||||||
printer port LCD
|
printer port LCD
|
||||||
|
|
||||||
D0 (2) D0 (7)
|
D0 (2) D0 (7)
|
||||||
D1 (3) D1 (8)
|
D1 (3) D1 (8)
|
||||||
D2 (4) D2 (9)
|
D2 (4) D2 (9)
|
||||||
D3 (5) D3 (10)
|
D3 (5) D3 (10)
|
||||||
D4 (6) D4 (11)
|
D4 (6) D4 (11)
|
||||||
D5 (7) D5 (12)
|
D5 (7) D5 (12)
|
||||||
D6 (8) D6 (13)
|
D6 (8) D6 (13)
|
||||||
D7 (9) D7 (14)
|
D7 (9) D7 (14)
|
||||||
nSEL (17) -
|
nSEL (17) -
|
||||||
nSTRB (1) RS (4)
|
nSTRB (1) RS (4)
|
||||||
nLF (14) RW (5) (LCD2 - 6) (optional - pull all LCD RW low)
|
nLF (14) RW (5) (LCD2 - 6) (optional - pull all LCD RW low)
|
||||||
INIT (16) EN (6)
|
INIT (16) EN (6)
|
||||||
|
|
||||||
See the lcdtime tar-ball (above) for full details of the bargraph
|
See the lcdtime tar-ball (above) for full details of the bargraph
|
||||||
connections.
|
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
|
1.5 Serial LPT
|
||||||
---------------
|
---------------
|
||||||
@@ -143,6 +330,8 @@ HD44780. Suitable for high noise, long connections. Designed by
|
|||||||
Andrew McMeikan <andrewm@engineer.com>. Refer to
|
Andrew McMeikan <andrewm@engineer.com>. Refer to
|
||||||
http://members.xoom.com/andrewmuck for details of the connections.
|
http://members.xoom.com/andrewmuck for details of the connections.
|
||||||
|
|
||||||
|
Note from Joris: I still need to add keypad stuff here
|
||||||
|
|
||||||
|
|
||||||
2. Compiling
|
2. Compiling
|
||||||
------------
|
------------
|
||||||
@@ -160,8 +349,9 @@ Keep in mind the following points.
|
|||||||
- When specifying the lcd size, do so before the -d argument.
|
- 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
|
- Arguments that need to be passed to the driver should be in quotes after
|
||||||
the -d HD44780 arguments.
|
the -d HD44780 arguments.
|
||||||
- Use the "-e" argument for extended interfaces (e.g. >= 3 displays as
|
- Use the "-e" argument for extended interfaces (e.g. 3 or more displays as
|
||||||
indicated by "optional" connections above).
|
indicated by "optional" connections above).
|
||||||
|
- Use "-k" to enable the keypad code.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
|
|||||||
Reference in New Issue
Block a user