File: hd44780.docbook

package info (click to toggle)
lcdproc 0.4.3-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,964 kB
  • ctags: 1,838
  • sloc: ansic: 21,286; sh: 2,871; perl: 574; makefile: 101
file content (1075 lines) | stat: -rw-r--r-- 26,946 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
<sect1 id="hd44780-howto">
<title>The HD44780 Driver</title>

<para>
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.
</para>
<para>
The LCDproc HD44780 driver supports the following connections on a
parallel port:
</para>
<itemizedlist>
<listitem><para>4-bit</para></listitem>
<listitem><para>8-bit (winamp style)</para></listitem>
<listitem><para>extended 8-bit (LCD + LED bargraph)</para></listitem>
<listitem><para>serial LPT</para></listitem>
</itemizedlist>
<para>
And supports a PIC-an-LCD connected to a serial port.
</para>
<para>
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.
</para>

<sect2 id="hd44780-connections">
<title>Connections</title>

<sect3 id="hd44780-connections-common">
<title>Common connections for all connectiontypes</title>

<para>
No matter what connectiontype you choose, you will always need some
connections. They are explaned here.
</para>

<sect4 id="hd44780-connections-power">
<title>Power</title>

<para>
All variants use the same method of obtaining power. i.e., for each LCD:
</para>

<table>
<title>HD44780: Power Connections</title>
<tgroup cols="3">
<thead>
<row>
<entry>LCD</entry>
<entry>pin</entry>
<entry>signal</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>GND</entry>
<entry>(connect to any of pins 18 - 25 of you parallel port)</entry>
</row>
<row>
<entry>2</entry>
<entry>+5V</entry>
<entry></entry>
</row>
<row>
<entry>3</entry>
<entry>Vadj</entry>
<entry>(contrast)</entry>
</row>
</tbody>
</tgroup>
</table>

<warning>
<para>
Always double check your power connection, your display will probably
NOT survive a reversely connected supply !
</para>
</warning>

<para>
There are several ways to get 5V:
</para>

<itemizedlist>
<listitem><para>Connect to a 5V line intented for disk drives (the red
wire is 5V, black is GND).</para></listitem>
<listitem><para>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.</para></listitem>
<listitem><para>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...</para></listitem>
<listitem><para>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.</para></listitem>
</itemizedlist>

<figure>
<title>HD44780: Connecting the contrast adjusting pin (Vadj.)</title>
<screen>
<![CDATA[

     (variable resistor)
        .------.
 Vcc ---|  10k |--- GND
        `---^--'
           /|\
            |
          Vadj.

]]>
</screen>
</figure>

</sect4>

<sect4 id="hd44780-connections-keypad">
<title>Keypad</title>

<para>
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.
</para>

<sect5 id="hd44780-connections-keypad-direct">
<title>Direct Keys</title>

<para>
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.
</para>

<figure>
<title>HD44780: Direct Keys</title>
<screen>
<![CDATA[

      O 5V
      |
      |
      -
     | | 10k
     | |
      -
      |
      +-----------o input  (X)
      |
      |
      o
       \
      o
      |
      |
     === GND

]]>
</screen>
</figure>

<para>
By default, the following keystrokes are generated by the different keys:
</para>

<table>
<title>HD44780: Default Keystrokes</title>
<tgroup cols="2">
<tbody>
<row>
<entry>X0</entry>
<entry>A</entry>
</row>
<row>
<entry>X1</entry>
<entry>B</entry>
</row>
<row>
<entry>X2</entry>
<entry>C</entry>
</row>
<row>
<entry>X3</entry>
<entry>D</entry>
</row>
</tbody>
</tgroup>
</table>

</sect5>

<sect5 id="hd44780-connections-keypad-matrix">
<title>Matrix Keys</title>

<para>
Using a matrix, we can connect much more keys. To simplify the drawing here,
we replace all switches with an @ symbol:
</para>

<figure>
<title>HD44780: Single Matrix Key</title>
<screen>
<![CDATA[

             X line
                |
                |
  Y line ---+---------
            |   |                    |
            o   |               =  --@--
             \  |                    |
            o   |
            |   |
            +---+
                |
                |

]]>
</screen>
</figure>

<para>
We connect the matrix of keys like this:
</para>

<figure>
<title>HD44780: Complete Key Matrix</title>
<screen>
<![CDATA[

Y0 o---|<---@--@--@
            |  |  |
Y1 o---|<---@--@--@
            |  |  |
Y2 o---|<---@--@--@
            |  |  |
Y3 o---|<---@--@--@            O 5V
            |  |  |            |
    diodes  |  |  |     ___    |
    1N4148  +----------|___|---+
            |  |  |     ___    |
            |  +-------|___|---+
            |  |  |     ___    |
            |  |  +----|___|---+     resistors 22k
            |  |  |
            o  o  o
            X0 X1 X2

]]>
</screen>
</figure>

<para>
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:
</para>

<figure>
<title>HD44780: Keypad Layout</title>
<screen>
<![CDATA[

      X0 X1 X2 X3

Y0    1  2  3  A
Y1    4  5  6  B
Y2    7  8  9  C
Y3    *  0  #  D

]]>
</screen>
</figure>

<para>
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.
</para>

<para>
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.
</para>

<para>
If you want to use just one return line, for example with the serialLpt
wiring, it looks (completely drawn) like this:
</para>

<figure>
<title>HD44780: One Return Line</title>
<screen>
<![CDATA[

                  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

]]>
</screen>
</figure>

<tip>
<para>
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.
</para>
</tip>

</sect5>

</sect4>

<sect4 id="hd44780-connections-backlight">
<title>Backlight</title>

<para>
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:
</para>

<figure>
<title>HD44780: Backlight Wiring</title>
<screen>
<![CDATA[

                                             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

]]>
</screen>
</figure>

<caution>
<para>
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).
</para>
</caution>

<tip>
<para>
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.)
</para>
</tip>

</sect4>

</sect3>

<sect3 id="hd44780-4-bit">
<title>4-bit</title>

<para>
This is originally based on "lcdtext" (by Matthias Prinke).
</para>

<table>
<title>HD44780: 4-bit Pinouts (1)</title>
<tgroup cols="2">
<thead>
<row>
<entry>printer port</entry>
<entry>LCD</entry>
</row>
</thead>
<tbody>
<row>
<entry>D0 (2)</entry>
<entry>D4 (11)</entry>
</row>
<row>
<entry>D1 (3)</entry>
<entry>D5 (12)</entry>
</row>
<row>
<entry>D2 (4)</entry>
<entry>D6 (13)</entry>
</row>
<row>
<entry>D3 (5)</entry>
<entry>D7 (14)</entry>
</row>
<row>
<entry>D4 (6)</entry>
<entry>RS (4)</entry>
</row>
<row>
<entry>D5 (7)</entry>
<entry>RW (5) (LCD3 - 6) (optional - pull all LCD RW low)</entry>
</row>
<row>
<entry>D6 (8)</entry>
<entry>EN (6)</entry>
</row>
<row>
<entry>D7 (9)</entry>
<entry>EN2 (LCD2 - 6) (optional)</entry>
</row>
</tbody>
</tgroup>
</table>

<para>
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:
</para>

<table>
<title>HD44780: 4-bit Pinouts (2)</title>
<tgroup cols="2">
<thead>
<row>
<entry>printer port</entry>
<entry>LCD</entry>
</row>
</thead>
<tbody>
<row>
<entry>STR (1)</entry>
<entry>EN4</entry>
</row>
<row>
<entry>LF (14)</entry>
<entry>EN5</entry>
</row>
<row>
<entry>INIT (16)</entry>
<entry>EN6</entry>
</row>
<row>
<entry>SEL (17)</entry>
<entry>EN7</entry>
</row>
</tbody>
</tgroup>
</table>

<para>
The optional keypad can be connected as follows:
</para>

<table>
<title>HD44780: 4-bit Keypad Pinouts</title>
<tgroup cols="2">
<thead>
<row>
<entry>printer port</entry>
<entry>LCD</entry>
</row>
</thead>
<tbody>
<row>
<entry>D0 (2)</entry>
<entry>Y0</entry>
</row>
<row>
<entry>D1 (3)</entry>
<entry>Y1</entry>
</row>
<row>
<entry>D2 (4)</entry>
<entry>Y2</entry>
</row>
<row>
<entry>D3 (5)</entry>
<entry>Y3</entry>
</row>
<row>
<entry>D4 (6)</entry>
<entry>Y4</entry>
</row>
<row>
<entry>D5 (7)</entry>
<entry>Y5</entry>
</row>
<row>
<entry>nSTRB (1)</entry>
<entry>Y6</entry>
</row>
<row>
<entry>nLF  (14)</entry>
<entry>Y7</entry>
</row>
<row>
<entry>INIT (16)</entry>
<entry>Y8</entry>
</row>
<row>
<entry>nSEL (17)</entry>
<entry>Y9</entry>
</row>
<row>
<entry></entry>
<entry></entry>
</row>
<row>
<entry>nACK (10)</entry>
<entry>X0</entry>
</row>
<row>
<entry>BUSY (11)</entry>
<entry>X1</entry>
</row>
<row>
<entry>PAPEREND (12)</entry>
<entry>X2</entry>
</row>
<row>
<entry>SELIN (13)</entry>
<entry>X3</entry>
</row>
<row>
<entry>nFAULT (15)</entry>
<entry>X4</entry>
</row>
</tbody>
</tgroup>
</table>

<para>
The optional backlight wiring should be connected to D5, pin 7.
</para>

</sect3>

<sect3 id="hd44780-8-bit-winamp">
<title>8-bit "Winamp"</title>

<para>
This type of connection should work with winamp.
</para>

<figure>
<title>HD44780: "Winamp" wiring</title>
<screen>
<![CDATA[

  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)

]]>
</screen>
</figure>

<para>
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.
</para>

<para>
The optional keypad can be connected as follows:
</para>

<figure>
<title>HD44780: "Winamp" wiring - Keypad</title>
<screen>
<![CDATA[

  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

]]>
</screen>
</figure>

<para>
The optional backlight wiring should be connected to nSEL, pin 17.
</para>

</sect3>

<sect3 id="hd44780-8-bit-lcdtime">
<title>8-bit "lcdtime"</title>

<para>
This is originally based on "lcdtime" (by Benjamin Tse
<email>blt@ComPorts.com</email>) 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:
</para>

<para>
<ulink url="http://metalab.unc.edu/pub/linux/system/status/lcdtime-0.2.tar.gz">http://metalab.unc.edu/pub/linux/system/status/lcdtime-0.2.tar.gz</ulink>
<ulink url="http://metalab.unc.edu/pub/linux/system/status/meter-0.2.tar.gz">http://metalab.unc.edu/pub/linux/system/status/meter-0.2.tar.gz</ulink>
<ulink url="http://metalab.unc.edu/pub/linux/system/status/portato-1.2.tar.gz">http://metalab.unc.edu/pub/linux/system/status/portato-1.2.tar.gz</ulink>
</para>

<note>
<para>
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.
</para>
</note>

<para>
The LCD connections are:
</para>

<figure>
<title>HD44780: "lcdtime" wiring</title>
<screen>
<![CDATA[

  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)

]]>
</screen>
</figure>

<para>
See the lcdtime tar-ball (above) for full details of the bargraph
connections.
</para>

<para>
The optional keypad can be connected as follows:
</para>

<figure>
<title>HD44780: "lcdtime" wiring - keypad</title>
<screen>
<![CDATA[

  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

]]>
</screen>
</figure>

<para>
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.
</para>

</sect3>

<sect3 id="hd44780-seriallpt">
<title>Serial LPT</title>

<para>
This interface uses a handful of wires to interface to the
HD44780. Suitable for high noise, long connections. Designed by
Andrew McMeikan <email>andrewm@engineer.com</email>. The original wiring and
driver can be found at:
</para>
<para>
<ulink url="http://members.xoom.com/andrewmuck">http://members.xoom.com/andrewmuck</ulink>
</para>

<para>
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).
</para>

<para>
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 ! :)
</para>

<para>
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.
</para>

<para>
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.
</para>

<figure>
<title>HD44780: Serial LPT wiring ('simple')</title>
<screen>
<![CDATA[

                                        IC1
                                     -----------
                                    |   4094    |
                              5V    | shift reg |                     display
                               O    |           |                         /keys
                               |   1|           |3
                               +----|STR      Q0|---------------------o 7  D0
                               |    |           |4                         /Y0
           Data                |   2|         Q1|---------------------o 8  D1
   D3 5 o---------------------------|D          |5                         /Y1
                               |    |         Q2|---------------------o 9  D2
                               |   3|CK         |6                         /Y2
   D4 6 o---------------------------|         Q3|---------------------o 10 D3
                               |    |           |10                        /Y3
                               |  15|         Q4|---------------------o    Y4
                               +----|OE         |11
                                    |         Q5|---------------------o 4  RS
                                    |           |12                        /Y5
                                    |         Q6|---------------------o    Y6
                                    |           |13
                                    |         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

]]>
</screen>
</figure>

<para>
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.
</para>

<figure>
<title>HD44780: Serial LPT wiring ('complex')</title>
<screen>
<![CDATA[

                                        IC2
                                     -----------
                                    |  74HCT164 |
                                    | shift reg |                     display
                                    |           |                         /keys
           Data                    1|           |3
   D3 5 o-----------------------+---|D        Q0|---------------------o 7  D0
                                |   |           |4                         /Y0
                                |  2|         Q1|---------------------o 8  D1
                                +---|D          |5                         /Y1
                                    |         Q2|---------------------o 9  D2
                                    |           |6                         /Y2
                                    |         Q3|---------------------o 10 D3
                                    |           |10                        /Y3
           Clock                   8|         Q4|---------------------o    Y4
   D4 6 o---------------------------|CK         |11
                                    |         Q5|---------------------o 4  RS
                 ___       9|\ 8   9|_          |12                        /Y5
             +--|___|--+----| >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

]]>
</screen>
</figure>

<sect4 id="hd44780-seriallpt-keypad">
<title>Serial LPT Keypad</title>

<note>
<para>
To understand this part of the serialLpt documentation, you also need to
read the <link linkend="hd44780-connections-keypad">keypad section</link> in this document.
</para>
</note>

<para>
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.
</para>

<figure>
<title>HD44780: Serial LPT - Keypad return lines</title>
<screen>
<![CDATA[

  nACK (10)     X0
  BUSY (11)     X1
  PAPEREND (12) X2
  SELIN (13)    X3
  nFAULT (15)   X4

]]>
</screen>
</figure>

<para>
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:
</para>

<figure>
<title>HD44780: Serial LPT - Keypad return lines buffered</title>
<screen>
<![CDATA[

               1|\ 2    13|\ 12   ___
   keypad o-----| >o------| >o---|___|---+---o input pin on LPT port
   return       |/        |/      220E   |
                IC1       IC1           ---
                                        --- 1nF
                                         |
                                        ===

]]>
</screen>
</figure>

</sect4>

<sect4 id="hd44780-seriallpt-backlight">
<title>Serial LPT Backlight</title>

<para>
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
<link linkend="hd44780-connections-backlight">backlight section</link>
</para>

<figure>
<title>HD44780: Serial LPT - Backlight extra circuit</title>
<screen>
<![CDATA[

                 ___       3|\ 4
     Data o-----|___|--+----| >o----o BL output
   LPT-D3       470k   |    |/
                      ---   IC1
                      ---
                       |100nF
                       |
                      ===

]]>
</screen>
</figure>


</sect4>

</sect3>

<sect3 id="hd44780-picanlcd">
<title>PIC-an-LCD serial device "picanlcd"</title>

<para>
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.
</para>

</sect3>

</sect2>

<sect2 id=hd44780-compiling>
<title>Compiling</title>

<para>
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".
</para>

</sect2>

<sect2 id="hd44780-running">
<title>Running</title>

<para>
Modify the LCDd.conf file before you run LCDd. In this config file are
detailed instructions on how to configure the HD44780 driver.
</para>

<para>
Then as usual, start LCDd with the correct config file:
</para>
<para>
E.g. <command>LCDd -c ./LCDd.conf</command>
</para>
<para>
If you want to override the driver selection in LCDd.conf then use:
</para>
<para>
<command>LCDd -c ./LCDd.conf -d HD44780</command>
</para>
<para>
If you use this, the HD44780 driver will read the options from the config
file anyway.
</para>

</sect2>

<sect2 id="hd44780-miscellania">
<title>Miscellania</title>

<para>
This text has originally been taken from a message by Bill Farrow
<email>bfarrow@arrow.bsee.swin.edu.au</email>.
</para>

<para>
Updated February 2000, Benjamin Tse <email>blt@ComPorts.com</email>
</para>

<para>
Updated October 2001, Joris Robijn <email>joris@robijn.net</email>
</para>

<para>
Converted to docbook March 2002, Rene Wagner <email>reenoo@gmx.de</email>
</para>

</sect2>
</sect1>