├── README.md ├── docs └── lcdproc-user │ └── drivers │ └── hd44780.docbook ├── hd44780.so └── server └── drivers ├── hd44780-i2c.c └── hd44780-low.h /README.md: -------------------------------------------------------------------------------- 1 | # README # 2 | 3 | Update to lcdproc i2c to allow the pin configurations to be specified via LCDd.conf. 4 | 5 | # alternative wiring example # 6 | 7 | 8 | ``` 9 | 10 | PCF8574AP: P0 P1 P2 P3 P4 P5 P6 P7 11 | | | | | | | | | 12 | HD44780: RS RW EN BL D4 D5 D6 D7 13 | 14 | ``` 15 | 16 | LCDd.conf 17 | 18 | ``` 19 | ## Hitachi HD44780 driver ## 20 | [HD44780] 21 | ConnectionType=i2c 22 | Device=/dev/i2c-1 23 | Port=0x27 24 | Backlight=yes 25 | Size=20x4 26 | DelayBus=false 27 | DelayMult=1 28 | Keypad=no 29 | Speed=0 30 | i2c_line_RS=0x01 31 | i2c_line_RW=0x02 32 | i2c_line_EN=0x04 33 | i2c_line_BL=0x08 34 | i2c_line_D4=0x10 35 | i2c_line_D5=0x20 36 | i2c_line_D6=0x40 37 | i2c_line_D7=0x80 38 | Backlight=yes 39 | BacklightInvert=yes 40 | ``` 41 | 42 | The Backlight Invert is used if a 0 turns the backlight on, and 1 turns it off, i.e. PNP 43 | transistor 44 | 45 | See discussion here: 46 | http://sourceforge.net/p/lcdproc/discussion/312/thread/00298b2f/ 47 | 48 | 49 | Added compiled hd44780.so - save to: 50 | /usr/lib/lcdproc/hd44780.so 51 | -------------------------------------------------------------------------------- /docs/lcdproc-user/drivers/hd44780.docbook: -------------------------------------------------------------------------------- 1 | 2 | The HD44780 Driver 3 | 4 | 5 | The HD44780 has become the de-facto standard of alphanumeric character displays. 6 | Although the original Hitachi HD44780 is long out of production, its command 7 | set has survived in a variety of (fully or nearly) compatible LCD, VFD and 8 | even OLED displays sold by a broad range of manufacturers all over the world. 9 | To name only a few: KS0066, KS0070, KS0076, LC7985, NT3881, SED1278, ST7066 ... 10 | 11 | 12 | 13 | The command set of these displays, which sometimes are advertised as being 14 | "industry standards compatible", is thus the workhorse of controllers for 15 | displays ranging from 8x1 to 20x4 or 40x2 characters. 16 | There are even displays with larger dimensions sporting two controllers, 17 | one for each half of the display. 18 | 19 | 20 | 21 | The HD44780 driver supports various ways of connecting HD44780 devices 22 | to your system. 23 | Each of these different ways is called a connection type 24 | of the driver. 25 | 26 | 27 | 28 | Depending on the connection type and the display connected, the driver supports 29 | various special features. 30 | 31 | Input keys 32 | Software controllable brightness / backlight 33 | Software controllable contrast 34 | multiple displays / multi-controller displays 35 | 36 | 37 | 38 | 39 | The following table lists the available connection types, sorted by the kind 40 | of connection (parallel port, serial port, USB, I2C, SPI or others). 41 | 42 | 43 | 44 | 45 | HD44780: Connection Types 46 | 47 | 48 | 49 | 50 | 51 | 52 | ConnectionType 53 | Wiring / Display Type 54 | 55 | 56 | 57 | 58 | 59 | Parallel port connection types: 60 | 61 | 62 | 4bit 63 | 4-bit wiring. This is the default. 64 | 65 | 66 | 8bit 67 | 8-bit wiring ("lcdtime" style) 68 | 69 | 70 | winamp 71 | 8-bit wiring ("winamp" style) 72 | 73 | 74 | serialLpt 75 | Serial LPT wiring 76 | 77 | 78 | 79 | Serial (RS-232) connection types: 80 | 81 | 82 | picanlcd 83 | PIC-an-LCD serial device "picanlcd" 84 | 85 | 86 | lcdserializer 87 | LCD serializer "lcdserializer" 88 | 89 | 90 | los-panel 91 | LCD on Serial panel device "los-panel" () 92 | 93 | 94 | vdr-lcd 95 | VDR LCD serial device "vdr-lcd" 96 | 97 | 98 | vdr-wakeup 99 | VDR-Wakeup module "vdr-wakeup" 100 | 101 | 102 | 103 | USB connection types: 104 | 105 | 106 | pertelian 107 | Pertelian X2040 LCD display () 108 | 109 | 110 | lis2 111 | LIS2 from VLSystem () 112 | 113 | 114 | mplay 115 | MPlay Blast from VLSystem () 116 | 117 | 118 | usblcd 119 | USBLCD adapter from Adams IT Services () 120 | 121 | 122 | bwctusb 123 | BWCT USB device "bwctusb" () 124 | 125 | 126 | lcd2usb 127 | Till Harbaum's LCD2USB () 128 | 129 | 130 | usbtiny 131 | Dick Streefland's USBtiny () 132 | 133 | 134 | uss720 135 | Belkin USS-720 USB-to-IEEE 1284 Bridge (Belkin F5U002) 136 | 137 | 138 | USB-4-all 139 | The USB-4-all controller board from Sprut () 140 | 141 | 142 | ftdi 143 | Display connected to a FTDI RS2232 (dual channel) or 144 | FTDI RS232 (single channel) USB chip 145 | 146 | 147 | 148 | I2C connection types: 149 | 150 | 151 | i2c 152 | LCD driven by PCF8574(A)/PCA9554(A) connected via I2C 153 | 154 | 155 | piplate 156 | Adafruit RGB Positive 16x2 LCD+Keypad for Raspberry Pi 157 | 158 | 159 | 160 | SPI (Serial Peripheral Interface): 161 | 162 | 163 | spi 164 | Display using a KS0073 or similar in serial mode accessed via Linux SPI device 165 | 166 | 167 | pifacecad 168 | PiFace Control and Display for Raspberry Pi 169 | 170 | 171 | 172 | Other connection types: 173 | 174 | 175 | ethlcd 176 | Display connected via TCP to PoE powered ethlcd device 177 | () 178 | 179 | 180 | raspberrypi 181 | LCD connected to the GPIO header of a Raspberry Pi 182 | 183 | 184 | 185 |
186 | 187 | 188 | 189 | 190 | If you suspect the table above to be outdated, you might want to have a look at 191 | server/drivers/hd44780-drivers.h in LCDproc's 192 | source directory which contains the actual translation code. 193 | 194 | 195 |
196 | 197 | 198 | 199 | Connections 200 | 201 | 202 | Common connections for all connection types 203 | 204 | 205 | No matter what connection type you choose, you will always need some 206 | connections. They are explained here. 207 | 208 | 209 | 210 | Power 211 | 212 | 213 | All variants use the same method of obtaining power. i.e., for each LCD: 214 | 215 | 216 | 217 | HD44780: Power Connections 218 | 219 | 220 | 221 | 222 | 223 | LCD 224 | Signal 225 | 226 | 227 | name 228 | pin 229 | 230 | 231 | 232 | 233 | VEE 234 | 1 235 | GND (connect to any of pins 18 - 25 of you parallel port) 236 | 237 | 238 | VCC 239 | 2 240 | +5V 241 | 242 | 243 | VLC 244 | 3 245 | (contrast adjustment) 246 | 247 | 248 | 249 |
250 | 251 | 252 | 253 | Always double check your power connection, your display will probably 254 | not survive a reversely connected supply ! 255 | 256 | 257 | 258 | 259 | There are several ways to get 5V: 260 | 261 | 262 | 263 | 264 | Connect to a 5V line intended for disk drives (the red wire is 5V, 265 | black is GND). 266 | 267 | 268 | Get it from the VCC and GND pins of an USB connector. 269 | For the USB connection types this is done automatically, as the circuits 270 | used there automatically power the LCD. 271 | 272 | 273 | Get it from a joystick port (pin 1 and 9 are 5V, 4, 5 and 12 are GND). 274 | It seems that some soundcards can use these lines for communication, 275 | so if you want to use this first check whether it really gives a 'clean' 5V. 276 | 277 | 278 | If you don't have a backlight, you can sometimes get the needed mA's 279 | from the LPT port itself. Connect a few diodes from the data pins to 280 | a capacitor and you have the 5V. If it's strong enough is another question... 281 | 282 | 283 | Get it from the keyboard connector. I do not recommend to use this with 284 | a backlight, as the keyboard connector is often protected with a fuse 285 | of 100mA or 200mA. 286 | 287 | 288 | 289 |
290 | HD44780: Connecting the contrast adjusting pin (V<subscript>LC</subscript>) 291 | 292 | 303 | 304 |
305 | 306 |
307 | 308 | 309 | Keypad 310 | 311 | 312 | You can connect a keypad with most connection types. The maximum supported 313 | number of keys differs per type. There are several ways to connect the keys 314 | to the input pins. 315 | 316 | 317 | 318 | Direct Keys 319 | 320 | 321 | If you connect a key like sketched below, then you can only connect one key 322 | per input pin. It is a simple solution if you need only few keys. 323 | 324 | 325 |
326 | HD44780: Direct Keys 327 | 328 | 349 | 350 |
351 | 352 | 353 | By default, the following keystrokes are generated by the different keys: 354 | 355 | 356 | HD44780: Direct Key Mapping 357 | 358 | 359 | 360 | key index 361 | mapped string 362 | 363 | 364 | 365 | 366 | X1 367 | A 368 | 369 | 370 | X2 371 | B 372 | 373 | 374 | X3 375 | C 376 | 377 | 378 | X4 379 | D 380 | 381 | 382 | X5 383 | E 384 | 385 | 386 | 387 |
388 | 389 | You can change the mapping using the 390 | KeyDirect_NUM 391 | configuration option, where NUM 392 | is the subscript to the X in the table above. 393 |
394 | 395 |
396 | 397 | 398 | Matrix Keys 399 | 400 | 401 | Using a matrix, we can connect much more keys. To simplify the drawing here, 402 | we replace all switches with an @ symbol: 403 | 404 | 405 |
406 | HD44780: Single Matrix Key 407 | 408 | 424 | 425 |
426 | 427 | 428 | We connect the matrix of keys like this: 429 | 430 | 431 |
432 | HD44780: Complete Key Matrix 433 | 434 | 455 | 456 |
457 | 458 | 459 | As you can see, you need 1 resistor per X line, and 1 diode per Y line. 460 | By default, lcdproc will presume that you have a keypad with a layout 461 | like a telephone connected, with X and Y lines connected as show. 462 | To be more precise, it assumes this mapping: 463 | 464 | 465 | 466 | HD44780: Matrix Keypad Layout 467 | 468 | 469 | 470 | 471 | X1 472 | X2 473 | X3 474 | X4 475 | X5 476 | 477 | 478 | Y1 479 | 1 480 | 2 481 | 3 482 | A 483 | E 484 | 485 | 486 | Y2 487 | 4 488 | 5 489 | 6 490 | B 491 | F 492 | 493 | 494 | Y3 495 | 7 496 | 8 497 | 9 498 | C 499 | G 500 | 501 | 502 | Y4 503 | * 504 | 0 505 | # 506 | D 507 | H 508 | 509 | 510 | 511 |
512 | 513 | 514 | This mapping can be changed using the 515 | KeyMatrix_X_Y 516 | configuration option, where X and 517 | Y are the subscripts to the respective axes above. 518 | 519 | 520 | 521 | If you only need e.g. 10 keys, leave the rest away. 522 | You should modify and recompile the 523 | driver to get an other keypad layout. 524 | 525 | 526 | 527 | You can buy arrays of keys that are connected like this in the electronics 528 | shop. They usually call it a matrix keypad. To hook it to lcdproc, you 529 | would only need to add the resistors and diodes. 530 | 531 | 532 | 533 | If you want to use just one return line, for example with the serialLpt 534 | wiring, it looks (completely drawn) like this: 535 | 536 | 537 |
538 | HD44780: One Return Line 539 | 540 | 558 | 559 |
560 | 561 | 562 | 563 | If the driver generates keypresses without that you actually press a key, 564 | it might be that the unconnected input lines are picking up 565 | electromagnetic waves from the air. In that case connect the unconnected 566 | input lines (pin 10, 11, 12, 13 and 15 of the LPT) to VCC = 5V. 567 | 568 | 569 | 570 |
571 | 572 |
573 | 574 | 575 | Backlight 576 | 577 | 578 | A small extension allows you to switch the backlight of the display on 579 | and off. At the moment only the 4bit and winamp 580 | connection types support this. 581 | The extension uses one output pin, you cannot use that pin for other 582 | functions anymore. The wiring looks like this: 583 | 584 | 585 |
586 | HD44780: Backlight Wiring 587 | 588 | 620 | 621 |
622 | 623 | 624 | 625 | Sometimes the backlight connections are not on the 'main' connector, but on 626 | the side. If that is the case, there is usually NO RESISTOR present to limit 627 | the current through the LEDs. Therefore you should then add a resistor after 628 | the transistor of about 10 ohm (see display documentation). 629 | 630 | 631 | 632 | 633 | 634 | If you want the backlight to light a bit while it is "switched off", you can 635 | add a resistor bypassing the transistor from e to c, with a value of, say 636 | 47ohm or 22ohm. (My 4x20 has an internal resistor of 6ohm, so with 47 ohm 637 | extra it lights at only 1/9th. I like this. Joris.) 638 | 639 | 640 | 641 |
642 | 643 |
644 | 645 | 646 | 4bit 647 | 648 | 649 | This wiring is originally based on "lcdtext" (by Matthias Prinke). 650 | 651 | 652 | 653 | HD44780: 4bit Pinouts (1) 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | printer port 663 | <-> 664 | LCD 665 | 666 | 667 | name 668 | pin 669 | name 670 | pin 671 | 672 | 673 | 674 | 675 | 676 | 677 | GND 678 | VEE 679 | 1 680 | 681 | 682 | 683 | 684 | +5V 685 | VCC 686 | 2 687 | 688 | 689 | 690 | 691 | (contrast adjustment) 692 | VLC 693 | 3 694 | 695 | 696 | D4 697 | 6 698 | 699 | RS 700 | 4 701 | 702 | 703 | 704 | 705 | GND 706 | RW 707 | 5 708 | 709 | 710 | D6 711 | 8 712 | 713 | EN 714 | 6 715 | 716 | 717 | D0 718 | 2 719 | 720 | D4 721 | 11 722 | 723 | 724 | D1 725 | 3 726 | 727 | D5 728 | 12 729 | 730 | 731 | D2 732 | 4 733 | 734 | D6 735 | 13 736 | 737 | 738 | D3 739 | 5 740 | 741 | D7 742 | 14 743 | 744 | 745 | 746 |
747 | 748 | 749 | 750 | The RW (pin 5) line of the display decides whether the display receives data from the 751 | LPT port, or whether it sends data to the LPT port: if grounded it receives, if High or connected 752 | to nothing at all it "sends" (i.e., will not work as intended). So, if you are not sure that 753 | you need it otherwise, then connect it to GND. This certainly applies if you have only one display. 754 | 755 | 756 | Theoretically this wiring sends the data over twice as slow as the 757 | winamp or ext8bit wirings, because it only sends 4 bits at a time. 758 | 759 | 760 | 761 | 762 | The 4bit connection type supports more than one display connected 763 | to the same parallel port. 764 | If you want to connect more than one display, then wire the all the displays to the 765 | parallel port according to the scheme above with the exception of the EN 766 | (pin 6) line of the LCDs. 767 | 768 | 769 | 770 | For the second and further displays, you can find the wiring for the EN 771 | (pin 6) line in the table below. 772 | 773 | 774 | 775 | HD44780: 4bit Pinouts (2) 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | printer port 785 | <-> 786 | LCD 787 | 788 | 789 | name 790 | pin 791 | name 792 | pin 793 | 794 | 795 | 796 | 797 | D7 798 | 9 799 | 800 | EN2 801 | 6 of 2nd display 802 | 803 | 804 | D5 805 | 7 806 | 807 | EN3 808 | 6 of 3rd display 809 | 810 | 811 | STR 812 | 1 813 | 814 | EN4 815 | 6 of 4th display 816 | 817 | 818 | LF 819 | 14 820 | 821 | EN5 822 | 6 of 5th display 823 | 824 | 825 | INIT 826 | 16 827 | 828 | EN6 829 | 6 of 6th display 830 | 831 | 832 | SEL 833 | 17 834 | 835 | EN7 836 | 6 of 7th display 837 | 838 | 839 | 840 |
841 | 842 | 843 | The optional keypad can be connected as follows: 844 | 845 | 846 | 847 | HD44780: 4bit Keypad Pinouts 848 | 849 | 850 | 851 | 852 | 853 | 854 | printer port 855 | <-> 856 | keypad 857 | remarks 858 | 859 | 860 | name 861 | pin 862 | pin 863 | 864 | 865 | 866 | 867 | D0 868 | 2 869 | 870 | Y1 871 | 872 | 873 | 874 | D1 875 | 3 876 | 877 | Y2 878 | 879 | 880 | 881 | D2 882 | 4 883 | 884 | Y3 885 | 886 | 887 | 888 | D3 889 | 5 890 | 891 | Y4 892 | 893 | 894 | 895 | D4 896 | 6 897 | 898 | Y5 899 | 900 | 901 | 902 | D5 903 | 7 904 | 905 | Y6 906 | Only if not used for backlight or 3rd controller. 907 | 908 | 909 | nSTRB 910 | 1 911 | 912 | Y7 913 | Only if not used for additional controllers. 914 | 915 | 916 | nLF 917 | 14 918 | 919 | Y8 920 | 921 | 922 | INIT 923 | 16 924 | 925 | Y9 926 | 927 | 928 | nSEL 929 | 17 930 | 931 | Y10 932 | 933 | 934 | nACK 935 | 10 936 | 937 | X1 938 | 939 | 940 | 941 | BUSY 942 | 11 943 | 944 | X2 945 | 946 | 947 | 948 | PAPEREND 949 | 12 950 | 951 | X3 952 | 953 | 954 | 955 | SELIN 956 | 13 957 | 958 | X4 959 | 960 | 961 | 962 | nFAULT 963 | 15 964 | 965 | X5 966 | 967 | 968 | 969 | 970 |
971 | 972 | 973 | The optional backlight wiring should be connected to D5, pin 7. 974 | 975 | 976 |
977 | 978 | 979 | 8bit "Winamp" 980 | 981 | 982 | This type of connection should work with winamp. 983 | 984 | 985 | 986 | HD44780: "Winamp" wiring 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | printer port 996 | <-> 997 | LCD 998 | 999 | 1000 | name 1001 | pin 1002 | name 1003 | pin 1004 | 1005 | 1006 | 1007 | 1008 | D0 1009 | 2 1010 | 1011 | D0 1012 | 7 1013 | 1014 | 1015 | D1 1016 | 3 1017 | 1018 | D1 1019 | 8 1020 | 1021 | 1022 | D2 1023 | 4 1024 | 1025 | D2 1026 | 9 1027 | 1028 | 1029 | D3 1030 | 5 1031 | 1032 | D3 1033 | 10 1034 | 1035 | 1036 | D4 1037 | 6 1038 | 1039 | D4 1040 | 11 1041 | 1042 | 1043 | D5 1044 | 7 1045 | 1046 | D5 1047 | 12 1048 | 1049 | 1050 | D6 1051 | 8 1052 | 1053 | D6 1054 | 13 1055 | 1056 | 1057 | D7 1058 | 9 1059 | 1060 | D7 1061 | 14 1062 | 1063 | 1064 | nSTRB 1065 | 1 1066 | 1067 | EN 1068 | 6 1069 | 1070 | 1071 | nLF 1072 | 14 1073 | 1074 | RW 1075 | 5 (EN3 6 - LCD 3) (optional (*) ) 1076 | 1077 | 1078 | INIT 1079 | 16 1080 | 1081 | RS 1082 | 4 1083 | 1084 | 1085 | nSEL 1086 | 17 1087 | 1088 | EN2 1089 | (6 - LCD 2) (optional) 1090 | 1091 | 1092 | 1093 |
1094 | 1095 | 1096 | (*) on the RW line of the display: this line decides whether the display receives data from the 1097 | LPT port, or whether it sends data to the LPT port: if grounded it receives, if High or connected 1098 | to nothing at all it "sends" (i.e., will not work as intended). So, if you are not sure that 1099 | you need it otherwise, then connect it to GND. This certainly applies if you have only one display. 1100 | 1101 | 1102 | 1103 | If you want the display to work with the Winamp plugin, wire nLF (pin 14) 1104 | to RW of your LCD. You can then use the plugin in bidirectional mode (which 1105 | is much faster). With 3 connected LCDs this is not possible. 1106 | Note from Benjamin: I haven't tried using winamp while having the third LCD 1107 | connected to this line. 1108 | 1109 | 1110 | 1111 | The optional keypad can be connected as follows: 1112 | 1113 | 1114 | 1115 | HD44780: "Winamp" wiring - Keypad 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | printer port 1123 | <-> 1124 | keypad 1125 | 1126 | 1127 | name 1128 | pin 1129 | pin 1130 | 1131 | 1132 | 1133 | 1134 | D0 1135 | 2 1136 | 1137 | Y1 1138 | 1139 | 1140 | D1 1141 | 3 1142 | 1143 | Y2 1144 | 1145 | 1146 | D2 1147 | 4 1148 | 1149 | Y3 1150 | 1151 | 1152 | D3 1153 | 5 1154 | 1155 | Y4 1156 | 1157 | 1158 | D4 1159 | 6 1160 | 1161 | Y5 1162 | 1163 | 1164 | D5 1165 | 7 1166 | 1167 | Y6 1168 | 1169 | 1170 | D6 1171 | 8 1172 | 1173 | Y7 1174 | 1175 | 1176 | D7 1177 | 9 1178 | 1179 | Y8 1180 | 1181 | 1182 | nACK 1183 | 10 1184 | 1185 | X1 1186 | 1187 | 1188 | BUSY 1189 | 11 1190 | 1191 | X2 1192 | 1193 | 1194 | PAPEREND 1195 | 12 1196 | 1197 | X3 1198 | 1199 | 1200 | SELIN 1201 | 13 1202 | 1203 | X4 1204 | 1205 | 1206 | nFAULT 1207 | 15 1208 | 1209 | X5 1210 | 1211 | 1212 | 1213 |
1214 | 1215 | 1216 | The optional backlight wiring should be connected to nSEL, pin 17. 1217 | 1218 | 1219 |
1220 | 1221 | 1222 | 8bit "lcdtime" 1223 | 1224 | 1225 | This is originally based on "lcdtime" (by Benjamin Tse 1226 | blt@ComPorts.com) and allows you to combine the LCD with a LED 1227 | bargraph. The LCD is driven by LCDproc and the LEDs by another program 1228 | such as portato. Further details can be obtained from: 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | The LCD connections are: 1245 | 1246 | 1247 | 1248 | HD44780: "lcdtime" wiring 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | printer port 1258 | <-> 1259 | LCD 1260 | 1261 | 1262 | name 1263 | pin 1264 | name 1265 | pin 1266 | 1267 | 1268 | 1269 | 1270 | D0 1271 | 2 1272 | 1273 | D0 1274 | 7 1275 | 1276 | 1277 | D1 1278 | 3 1279 | 1280 | D1 1281 | 8 1282 | 1283 | 1284 | D2 1285 | 4 1286 | 1287 | D2 1288 | 9 1289 | 1290 | 1291 | D3 1292 | 5 1293 | 1294 | D3 1295 | 10 1296 | 1297 | 1298 | D4 1299 | 6 1300 | 1301 | D4 1302 | 11 1303 | 1304 | 1305 | D5 1306 | 7 1307 | 1308 | D5 1309 | 12 1310 | 1311 | 1312 | D6 1313 | 8 1314 | 1315 | D6 1316 | 13 1317 | 1318 | 1319 | D7 1320 | 9 1321 | 1322 | D7 1323 | 14 1324 | 1325 | 1326 | nSEL 1327 | 17 1328 | 1329 | - 1330 | 1331 | 1332 | 1333 | nSTRB 1334 | 1 1335 | 1336 | RS 1337 | 4 1338 | 1339 | 1340 | nLF 1341 | 14 1342 | 1343 | RW 1344 | 5 (optional - pull LCD RW low (*) 1345 | 1346 | 1347 | INIT 1348 | 16 1349 | 1350 | EN 1351 | 6 1352 | 1353 | 1354 | 1355 |
1356 | 1357 | 1358 | (*) on the RW line of the display: this line decides whether the display receives data from the 1359 | LPT port, or whether it sends data to the LPT port: if grounded it receives, if High or connected 1360 | to nothing at all it "sends" (i.e., will not work as intended). So, if you are not sure that 1361 | you need it otherwise, then connect it to GND. 1362 | 1363 | 1364 | 1365 | See the lcdtime tar-ball (above) for full details of the bargraph 1366 | connections. 1367 | 1368 | 1369 | 1370 | The optional keypad can be connected as follows: 1371 | 1372 | 1373 | 1374 | HD44780: "lcdtime" wiring - keypad 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | printer port 1382 | <-> 1383 | keypad 1384 | 1385 | 1386 | name 1387 | pin 1388 | pin 1389 | 1390 | 1391 | 1392 | 1393 | D0 1394 | 2 1395 | 1396 | Y1 1397 | 1398 | 1399 | D1 1400 | 3 1401 | 1402 | Y2 1403 | 1404 | 1405 | D2 1406 | 4 1407 | 1408 | Y3 1409 | 1410 | 1411 | D3 1412 | 5 1413 | 1414 | Y4 1415 | 1416 | 1417 | D4 1418 | 6 1419 | 1420 | Y5 1421 | 1422 | 1423 | D5 1424 | 7 1425 | 1426 | Y6 1427 | 1428 | 1429 | D6 1430 | 8 1431 | 1432 | Y7 1433 | 1434 | 1435 | D7 1436 | 9 1437 | 1438 | Y8 1439 | 1440 | 1441 | nSTRB 1442 | 1 1443 | 1444 | Y9 1445 | 1446 | 1447 | nSEL 1448 | 17 1449 | 1450 | Y10 (only if not used for backlight) 1451 | 1452 | 1453 | nACK 1454 | 10 1455 | 1456 | X1 1457 | 1458 | 1459 | BUSY 1460 | 11 1461 | 1462 | X2 1463 | 1464 | 1465 | PAPEREND 1466 | 12 1467 | 1468 | X3 1469 | 1470 | 1471 | SELIN 1472 | 13 1473 | 1474 | X4 1475 | 1476 | 1477 | nFAULT 1478 | 15 1479 | 1480 | X5 1481 | 1482 | 1483 | 1484 |
1485 | 1486 | 1487 | The backlight wiring should be attached to nSEL, pin 17. Because the portato 1488 | program (mentioned above) also uses this pin to control the bargraph, you 1489 | cannot use the backlight control together with the bargraph. 1490 | 1491 | 1492 |
1493 | 1494 | 1495 | Serial LPT 1496 | 1497 | 1498 | This interface uses a handful of wires to interface to the 1499 | HD44780. Suitable for high noise, long connections. Designed by 1500 | Andrew McMeikan andrewm@engineer.com. 1501 | 1502 | 1503 | 1504 | I (Joris) have extended this driver and the wiring a bit. It now supports 1505 | keys again (it had earlier supported keys, but some time did not). 1506 | 1507 | 1508 | 1509 | Further I have extended the driver and the wiring to be able to run 1510 | using 2 instead of 3 output pins. That's even one less pin ! :) 1511 | 1512 | 1513 | 1514 | Of course the use of fewer lines than the other wirings can not stay 1515 | without drawbacks. In this case the simplicity of the long feeding wires 1516 | is compensated by some intelligence in the decoding of the data. If you 1517 | have no experience with the soldering iron, I do not recommend to build 1518 | this wiring. 1519 | 1520 | 1521 | 1522 | OK, so here is the wiring. First of the 'simple' 3 wires version. IC1 is 1523 | the shift register, a 4094. Do not forget to connect the 5V to pin 16 and 1524 | GND to pin 8 of the IC. 1525 | 1526 | 1527 |
1528 | HD44780: Serial LPT wiring ('simple') 1529 | 1530 | 1579 | 1580 |
1581 | 1582 | 1583 | The second possible wiring is with 2 output lines. This one is a bit more 1584 | complex. If you do not understand the schematic, do not build it. 1585 | 1586 | 1587 |
1588 | HD44780: Serial LPT wiring ('complex') 1589 | 1590 | o----|R Q6|--------------------o Y7 1611 | | 22k | |/ | |13 1612 | | --- IC1 | Q7|---+ +--o 5 RW 1613 | | --- | | | 5V | 1614 | | |100p ----------- | O === 1615 | | | | | 1616 | | === | .-. 1617 | | | | |22k 1618 | +--------------------------------------+ | | 1619 | | '-' 1620 | | ___ 11|\ 10 | 5|\ 6 1621 | +--|___|--+----| >o-------------------||-----+----| >o--o 6 EN 1622 | 22k | |/ 22p |/ 1623 | --- IC1 IC1 1624 | --- 1625 | |22p 1626 | | IC1=74HCT14 (6x Schmitt trigger inverter) 1627 | === 1628 | 1629 | 1630 | 5V O--+-------+------+------+-----------------------+-----o 2 VCC 1631 | | | | | 13|\ 12 | 1632 | | | | +---| >o- | 1633 | |100n O 14 O 14 |/ .-. 1634 | --- IC1 IC2 | |<---o 3 Vlcd 1635 | --- O 7 O 7 1|\ 2 3|\ 4 | |10k 1636 | | | | +--| >o- +--| >o- '-' 1637 | GND | | | | |/ | |/ | 1638 | 18..25 o------+-------+------+-------+----------+-----+-----+-----o 1 GND 1639 | | 1640 | === GND 1641 | 1642 | ]]> 1643 | 1644 |
1645 | 1646 | 1647 | Serial LPT Keypad 1648 | 1649 | 1650 | 1651 | To understand this part of the serialLpt documentation, you also need to 1652 | read the keypad section in this document. 1653 | 1654 | 1655 | 1656 | 1657 | serialLpt wiring supports a keypad. The 3 wires version supports 1658 | 8 keys, or if you use multiple return lines up to 8 x 5 = 40 lines. The 1659 | 2 wires version supports 7 keys, or with multiple return lines 1660 | 7 x 5 = 35 keys. 1661 | 1662 | 1663 | 1664 | HD44780: Serial LPT - Keypad return lines 1665 | 1666 | 1667 | 1668 | 1669 | 1670 | 1671 | printer port 1672 | <-> 1673 | keypad 1674 | 1675 | 1676 | name 1677 | pin 1678 | pin 1679 | 1680 | 1681 | 1682 | 1683 | nACK 1684 | 10 1685 | 1686 | X1 1687 | 1688 | 1689 | BUSY 1690 | 11 1691 | 1692 | X2 1693 | 1694 | 1695 | PAPEREND 1696 | 12 1697 | 1698 | X3 1699 | 1700 | 1701 | SELIN 1702 | 13 1703 | 1704 | X4 1705 | 1706 | 1707 | nFAULT 1708 | 15 1709 | 1710 | X5 1711 | 1712 | 1713 | 1714 |
1715 | 1716 | 1717 | On lines longer than, say a meter, you should buffer the return line(s). 1718 | If you only have 1 return line, you can buffer it with two remaining 1719 | buffers from the 74HCT14: 1720 | 1721 | 1722 |
1723 | HD44780: Serial LPT - Keypad return lines buffered 1724 | 1725 | o------| >o---|___|---+---o input pin on LPT port 1729 | return |/ |/ 220E | 1730 | IC1 IC1 --- 1731 | --- 1nF 1732 | | 1733 | === 1734 | 1735 | ]]> 1736 | 1737 |
1738 | 1739 |
1740 | 1741 | 1742 | Serial LPT Backlight 1743 | 1744 | 1745 | Also a backlight is supported. You will also need a port from the 74HCT14 for 1746 | that. The BL output below should be connected to the BL input in the 1747 | backlight section 1748 | 1749 | 1750 |
1751 | HD44780: Serial LPT - Backlight extra circuit 1752 | 1753 | o----o BL output 1757 | LPT-D3 470k | |/ 1758 | --- IC1 1759 | --- 1760 | |100nF 1761 | | 1762 | === 1763 | 1764 | ]]> 1765 | 1766 |
1767 | 1768 |
1769 | 1770 |
1771 | 1772 | 1773 | spi 1774 | 1775 | 1776 | This connection type drives a LCD in serial mode (supported on Hitachi HD66712, 1777 | Samsung KS0073 and KS0074 (and clones) controllers) connected to some Linux 1778 | SPI device. 1779 | 1780 | 1781 | This connection type is currently only supported on Linux. It is strongly 1782 | recommended to use a SPI implementation with hardware support, e.g. on the 1783 | Raspberry Pi. 1784 | 1785 | 1786 | As the SPI communication to the display cannot drive a backlight switch, this 1787 | connection type features a BacklightDevice option 1788 | that can use a GPIO pin exposed via sysfs (see eLinux GPIO). 1789 | 1790 | 1791 | 1792 | 1793 | 1794 | FTDI FT2232D USB chip "ftdi" 1795 | 1796 | 1797 | You can use a FTDI FT2232D dual channel USB <-> parallel FIFO chip 1798 | to connect a display via the USB bus. The chip is switched to bitbang mode 1799 | and drives both channels as outputs to control the display in 8bit mode. 1800 | 1801 | 1802 | 1803 | HD44780: 8bit FTDI 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | FTDI chip 1813 | <-> 1814 | LCD 1815 | 1816 | 1817 | name 1818 | pin 1819 | name 1820 | pin 1821 | 1822 | 1823 | 1824 | 1825 | ADBUS0 1826 | 24 1827 | 1828 | D0 1829 | 7 1830 | 1831 | 1832 | ADBUS1 1833 | 23 1834 | 1835 | D1 1836 | 8 1837 | 1838 | 1839 | ADBUS2 1840 | 22 1841 | 1842 | D2 1843 | 9 1844 | 1845 | 1846 | ADBUS3 1847 | 21 1848 | 1849 | D3 1850 | 10 1851 | 1852 | 1853 | ADBUS4 1854 | 20 1855 | 1856 | D4 1857 | 11 1858 | 1859 | 1860 | ADBUS5 1861 | 19 1862 | 1863 | D5 1864 | 12 1865 | 1866 | 1867 | ADBUS6 1868 | 18 1869 | 1870 | D6 1871 | 13 1872 | 1873 | 1874 | ADBUS7 1875 | 17 1876 | 1877 | D7 1878 | 14 1879 | 1880 | 1881 | BDBUS0 1882 | 40 1883 | 1884 | RS 1885 | 4 1886 | 1887 | 1888 | BDBUS1 1889 | 39 1890 | 1891 | RW 1892 | 5 1893 | 1894 | 1895 | BDBUS2 1896 | 38 1897 | 1898 | EN 1899 | 6 1900 | 1901 | 1902 | BDBUS3 1903 | 37 1904 | 1905 | BL 1906 | Backlight (optional) 1907 | 1908 | 1909 | 1910 |
1911 | 1912 | 1913 | You can configure the USB vendor/product ID in LCDd.conf. 1914 | The wiring of the control lines can optionally be reconfigured, 1915 | please look at the driver source if you really need that. 1916 | 1917 | 1918 | 1919 | The backlight line is driven high when the backlight is on. 1920 | Therefore the standard backlight circuit () 1921 | will not work. Use the following instead. 1922 | 1923 | 1924 |
1925 | hd44780/ftdi: Backlight Wiring 1926 | 1927 | 1947 | 1948 |
1949 | 1950 | 1951 | 1952 | Alternatively you can use a single channel FTDI FT245BM USB <-> parallel 1953 | FIFO chip and use the display in its 4 bit mode. 1954 | 1955 | 1956 | 1957 | HD44780: 4bit FTDI 1958 | 1959 | 1960 | 1961 | 1962 | 1963 | 1964 | 1965 | 1966 | FTDI chip 1967 | <-> 1968 | LCD 1969 | 1970 | 1971 | name 1972 | pin 1973 | name 1974 | pin 1975 | 1976 | 1977 | 1978 | 1979 | D0 1980 | 25 1981 | 1982 | D4 1983 | 11 1984 | 1985 | 1986 | D1 1987 | 24 1988 | 1989 | D5 1990 | 12 1991 | 1992 | 1993 | D2 1994 | 23 1995 | 1996 | D6 1997 | 13 1998 | 1999 | 2000 | D3 2001 | 22 2002 | 2003 | D7 2004 | 14 2005 | 2006 | 2007 | D4 2008 | 21 2009 | 2010 | EN 2011 | 6 2012 | 2013 | 2014 | D5 2015 | 20 2016 | 2017 | RS 2018 | 4 2019 | 2020 | 2021 | D6 2022 | 19 2023 | 2024 | RW 2025 | 5 2026 | 2027 | 2028 | D7 2029 | 18 2030 | 2031 | BL 2032 | Backlight (optional) 2033 | 2034 | 2035 | 2036 |
2037 | 2038 | 2039 | The following special configuration settings are required to use a single 2040 | channel FTDI FIFO chip: 2041 | 2042 | 2043 | 2044 | HD44780: Configuration for FTDI 4bit 2045 | 2046 | 2055 | 2056 | 2057 | 2058 | 2059 |
2060 | 2061 | 2062 | LIS2 USB device "lis2" 2063 | 2064 | 2065 | LIS2 from VLSystem () 2066 | is a full featured USB VFD module with four channel fan controls. 2067 | This device can be accessed as a serial device with the help of the kernel 2068 | module ftdi_sio.ko that maps the USB port to a serial port 2069 | (e.g. /dev/ttyUSBx). 2070 | 2071 | 2072 | 2073 | 2074 | 2075 | MPlay Blast USB device "mplay" 2076 | 2077 | 2078 | MPlay Blast from VLSystem () 2079 | is a full featured USB VFD module with two channel fan controls and 2080 | two channel temperature sensors. 2081 | This device can be accessed as a serial device with the help of the kernel 2082 | module ftdi_sio.ko that maps the USB port to a serial port 2083 | (e.g. /dev/ttyUSBx). 2084 | 2085 | 2086 | 2087 | 2088 | 2089 | LCD on Serial panel device "los-panel" 2090 | 2091 | The LoS-Panel is a DIY device built using an Atmel ATtiny2313 and 2092 | supports the following features: 2093 | 2094 | Drives displays with one controller. 2095 | Switchable backlight. 2096 | One 4x4 matrix keypad and 4 direct keys. 2097 | 2098 | 2099 | 2100 | 2101 | 2102 | The direct keys are reported as a fifth column of a matrix keypad to LCDd. 2103 | 2104 | 2105 | Column and rows are reported reverse (column 1 / row 1 is in the lower 2106 | right corner) to LCDd which expects (1/1) to be the upper left corner. 2107 | You have to take this into account when configuring keys. 2108 | 2109 | 2110 | 2111 | 2112 | See 2113 | for more information on this device. 2114 | 2115 | 2116 | 2117 | 2118 | 2119 | VDR LCD serial device "vdr-lcd" 2120 | 2121 | 2122 | … to be documented … 2123 | 2124 | 2125 | 2126 | Please address Matteo Pillon for further information. 2127 | 2128 | 2129 | 2130 | 2131 | 2132 | VDR-Wakeup module "vdr-wakeup" 2133 | 2134 | 2135 | The VDR-Wake module by Frank Jepsen is a serial IO extension module for the 2136 | famous Linux-based VDR that allows to connect an LCD to it and supports LCDproc. 2137 | 2138 | 2139 | 2140 | See 2141 | (German) for more information on VDR-Wakeup. 2142 | 2143 | 2144 | 2145 | 2146 | 2147 | Pertelian X2040 "pertelian" 2148 | 2149 | 2150 | The Pertelian X2040 includes an HD44780 display with enclosure and USB 2151 | connection. 2152 | 2153 | In order to work with LCDproc in Linux you need 2154 | the usbserial.ko and ftdi_sio.ko 2155 | kernel modules loaded. The display will then be available on a 2156 | serial port /dev/ttyUSBx. 2157 | 2158 | 2159 | 2160 | See the 2161 | 2162 | X4020 product page for more information. 2163 | 2164 | 2165 | 2166 | 2167 | 2168 | 2169 | PIC-an-LCD serial device "picanlcd" 2170 | 2171 | 2172 | The PIC-an-LCD module is also supported. It is not connected to the LPT port 2173 | but to a serial port, which saves you from a lot of potential problems. 2174 | To use it, specify the device to which you have connected the module in the 2175 | config file with the Device setting. 2176 | The default is /dev/lcd. 2177 | It does not support a keypad nor backlight switching. 2178 | 2179 | 2180 | 2181 | 2182 | As of 2012 these devices are not sold anymore. Search the Internet Archive for 2183 | a copy of if you need 2184 | the manual. 2185 | 2186 | 2187 | 2188 | 2189 | 2190 | 2191 | LCD serializer device "lcdserializer" 2192 | 2193 | 2194 | LCD serializer connection is technically the same as PIC-an-LCD with the same advantages, 2195 | it uses the serial port making things really simple. 2196 | Unlike PIC-an-LCD 2197 | LCD serializer 2198 | is not a commercial product. it's just a project found digging on the net and freely available. 2199 | You have all the tools and the code to build it yourself and to customize the behaviour of the device. 2200 | 2201 | 2202 | 2203 | What you need 2204 | 2205 | 2206 | 2207 | Some electronic knowledge and familiarity with the soldering iron 2208 | A PIC16F84 (I used PIC16F84A) or PIC16C54 2209 | JDM PIC programmer 2210 | gputils and picprog installed on your GNU/Linux box 2211 | 2212 | 2213 | 2214 | 2215 | 2216 | Burning the PIC 2217 | 2218 | 2219 | First, you need to download the ASM source for your PIC and then make the hex: 2220 | 2221 | 2222 | 2223 | $ gpasm lcd16f84_custom.asm 2224 | 2225 | 2226 | 2227 | Now the binary is ready to be flashed to the PIC. 2228 | Connect the programmer with the PIC installed and issue the following command to see it burning ;-): 2229 | 2230 | 2231 | 2232 | $ picprog --erase --burn --input lcd16f84.hex --pic /dev/ttyS0 2233 | 2234 | 2235 | 2236 | 2237 | 2238 | Running lcdproc 2239 | 2240 | 2241 | It's time to build the operating circuit, 2242 | remember this driver uses a baud rate of 9600, so JP2 need to be closed. 2243 | 2244 | 2245 | 2246 | Now power on the board. You should see OK on the LCD screen. 2247 | Otherwise double-check all the connections. 2248 | 2249 | 2250 | 2251 | Change LCDd.conf to include the following statements in the [hd44780] section: 2252 | 2253 | 2254 | 2255 | ConnectionType=lcdserializer 2256 | Device=/dev/ttyS0 2257 | 2258 | 2259 | 2260 | Finally, start the daemon and relax watching lcdproc running. 2261 | 2262 | 2263 | 2264 | 2265 | 2266 | 2267 | BWCT USB LCD module "bwctusb" 2268 | 2269 | 2270 | The BWCT USB LCD module, sold by Bernd Walter Computing Technology 2271 | () is a little board 2272 | that can be piggy-packed to a HD44780 display and connects that to USB. 2273 | 2274 | 2275 | 2276 | The board, driven by the bwctusb connection type, 2277 | does neither support a keypad for input, nor more than one single-controller 2278 | display, nor does it allow setting the backlight or brightness. 2279 | But you can set the display's contrast using software 2280 | (see the Contrast configuration parameter). 2281 | 2282 | 2283 | 2284 | Special configuration options 2285 | 2286 | 2287 | If there is more than one BWCT USB module connected to the system, 2288 | the SerialNumber configuration parameter allows 2289 | selecting which display is used in LCDd. 2290 | 2291 | 2292 | 2293 | 2294 | 2295 | 2296 | 2297 | 2298 | Till Harbaum's "lcd2usb" 2299 | 2300 | 2301 | LCD2USB 2302 | is a cheap but powerful do-it-yourself interface to connect HD44780 2303 | based displays via USB, consisting of easily available parts only. 2304 | The device supports software adjustable contrast and backlight 2305 | as well as dual controller displays (required for 4*27 and 4*40). 2306 | 2307 | 2308 | 2309 | It is based upon an Atmel AVR Mega8 CPU with a pure software implementation 2310 | of the USB protocol for the Atmel AVR microcontroller series. 2311 | 2312 | 2313 | 2314 | The whole interface incl. the hardware layout is under a GPL like license. 2315 | This means that you can take these schematics and use it as a basis 2316 | for your own interface e.g. for a graphic LCD. 2317 | 2318 | 2319 | 2320 | Two keys can be connected to the LCD2USB interface board. 2321 | They can generate three key events that can be mapped to key names using 2322 | the DirectKey_1 to DirectKey_3 commands: 2323 | one for each key and the third if the keys are pressed simultaneously. 2324 | With this 3-key setup, menus can be used (see example below). 2325 | 2326 | 2327 | 2328 | This driver supports the original LCD2USB interface board as described above 2329 | as well as compatible devices like those sold by Lcdmod Kit 2330 | or those developed by Malte Pöggel. 2331 | 2332 | 2333 | 2334 | Special configuration options 2335 | 2336 | 2337 | Besides the standard configuration options for hd44780 displays, the 2338 | lcd2usb connection type supports three additional options: 2339 | Contrast to set the display's contrast, 2340 | Brightness to set the display's brightness when the backlight is switched on and 2341 | OffBrightness to set the display's brightness when is backlight is switched off. 2342 | All three options expect a number in the range from 0 to 1000. 2343 | 2344 | 2345 | 2346 | HD44780: Configuration for LCD2USB 2347 | 2348 | 2366 | 2367 | 2368 | 2369 | 2370 | 2371 | In order to make the lcd2usb connection type work with a 2-controller display 2372 | you may need to set the vSpan config option accordingly. 2373 | 2374 | 2375 | 2376 | 2377 | 2378 | 2379 | 2380 | Dick Streefland's "USBtiny" 2381 | 2382 | 2383 | USBtiny 2384 | is a software implementation of the USB low-speed protocol for 2385 | the Atmel ATtiny microcontrollers. It is also the name of a 'reference 2386 | circuit' using the ATtiny2313. 2387 | 2388 | 2389 | 2390 | The reference circuit features an IR receiver for remote controls and a LCD. 2391 | Due to hardware limitations of the ATtiny2313 the LCD does not have switchable 2392 | backlight, adjustable contrast, any keys, nor does it support displays with 2393 | more than one controller. If you want these features and do not require the 2394 | IR receiver we recommend to take a look at the LCD2USB 2395 | device. 2396 | 2397 | 2398 | 2399 | 2400 | LCDproc does not make use of the IR receiver. 3rd party software is required 2401 | to make it do anything, e.g. LIRC. 2402 | 2403 | 2404 | 2405 | 2406 | 2407 | 2408 | 2409 | USS-720 USB-to-IEEE 1284 Bridge (Belkin F5U002) "uss720" 2410 | 2411 | 2412 | The USS-720 USB-to-IEEE 1284 Bridge is a fully featured USB to parallel chip that is used 2413 | in most (but not all) Belkin F5U002 USB Parallel Printer Adapters. Because these adapters are 2414 | inexpensive and readily available on the second-hand market, they provide an excellent solution 2415 | for users who want to experiment with a parallel port but only have USB ports on their computers. 2416 | 2417 | 2418 | 2419 | Because the chip acts as a parallel port, the driver maintains the same features and wiring as 2420 | the 8-bit "winamp" driver. However, because most USB Parallel Printer Adapters use a centronics 2421 | printer connector, be sure to convert the pin numbering of the parallel port pins in the "winamp" 2422 | wiring to the pin numbering of the centronics port. Many tables are available on the internet 2423 | that illustrate how the pin numbering differs between the two. 2424 | 2425 | 2426 | 2427 | Special configuration options 2428 | 2429 | 2430 | Because several manufacturers used the USS720 chip in their USB Parallel Printer Adapters, the 2431 | VendorID and ProductID options are configurable in the 2432 | LCDd.conf file. 2433 | 2434 | 2435 | 2436 | 2437 | Not all Belkin F5U002 USB Parallel Printer Adapters used the USS720 chip. Look for the dark grey 2438 | adapters with the removable USB cable for best results. 2439 | 2440 | 2441 | 2442 | 2443 | 2444 | 2445 | 2446 | 2447 | 2448 | I<superscript>2</superscript>C with Port-Expander 2449 | 2450 | 2451 | If you have an I2C port available that is supported by your kernel 2452 | (through /dev/i2c*), you can add a I2C 2453 | port expander there (PCF8574P in this example). 2454 | 2455 | 2456 |
2457 | HD44780: PCF8574P port expander on I<superscript>2</superscript>C bus 2458 | 2459 | 2500 | 2501 |
2502 | 2503 | 2504 | Configuration 2505 | 2506 | 2507 | HD44780: Configuration for I<superscript>2</superscript>C with port expander 2508 | 2509 | 2530 | 2531 | 2532 | 2533 | 2534 | If your port expander has different wiring you can re-assign the pins in the config file 2535 | 2536 | 2537 | 2538 | HD44780: Configuration for I<superscript>2</superscript>C with port expander 2539 | Alternative Wiring 2540 | 2541 | 2546 | 2547 | 2548 | 2549 | 2550 | HD44780: Configuration for I<superscript>2</superscript>C with port expander 2551 | alternative config 2552 | 2553 | 2575 | 2576 | 2577 | 2578 | 2579 | The Device configuration setting denotes the device file 2580 | of your I2C bus (here /dev/i2c-0). 2581 | You have to load the kernel standard module i2c-dev.ko and 2582 | the bus driver, but no I2C 2583 | chip modules (e.g. pcf8574.ko)! 2584 | 2585 | 2586 | 2587 | The Port config option contains the I2C 2588 | address of the I2C port expander 2589 | (here 0x20, the PCF8574 from the example above, with all address bits set to 0). 2590 | 2591 | Bit 8 of the address (normally 0 in I2C addresses) 2592 | has a special meaning: 2593 | It tells the driver to treat the device as PCA9554 or similar, 2594 | a device that needs a 2-byte command, and it will be stripped 2595 | off the address. 2596 | 2597 | 2598 | 2599 | HD44780: Examples of I<superscript>2</superscript>C port expander addresses 2600 | 2601 | 2602 | 2603 | Port value 2604 | Meaning 2605 | 2606 | 2607 | 2608 | 2609 | 0x200x27 2610 | PCF8574 with A[012]=07 2611 | 2612 | 2613 | 0x380x3f 2614 | PCF8574A with A[012]=07 2615 | 2616 | 2617 | 0xa00xa7 2618 | PCA9554 with A[012]=07 2619 | 2620 | 2621 | 0xa00xa7 2622 | PCA9554A with A[012]=07 2623 | 2624 | 2625 | 2626 |
2627 | 2628 |
2629 | 2630 |
2631 | 2632 | 2633 | ethlcd Device 2634 | 2635 | 2636 | The ethlcd () device is simply 2637 | an LCD display driven by an ATmega microcontroller, controlled and powered by 2638 | "home-made" Power over Ethernet. The hardware and software are open source. 2639 | 2640 | 2641 | Features 2642 | ethernet connection using ENC28J60 ethernet controller 2643 | Power over Ethernet (data and power using single UTP cable) 2644 | Atmel's ATmega168 microcontroller 2645 | 6 buttons (MENU, UP, DOWN, LEFT, RIGHT, ENTER) 2646 | backlight control in three states: ON, Night-Mode (partialy ON) and OFF 2647 | beeper 2648 | device act as a TCP server - LCDproc driver is connecting to device just by creating 2649 | a TCP socket - no need to PC-side additional hardware besides NIC 2650 | 2651 | 2652 | 2653 |
2654 | HD44780: ethlcd - block diagram 2655 | 2656 | | ethernet |<========+------> PC running 2667 | | | | | | | controller | | | LCDproc 2668 | | | | | | | | | | 2669 | | |_________| |___________| |____________| | | 2670 | | | | | 2671 | | | | | 2672 | | beeper | | 2673 | |_____________________________________________________| | 2674 | ethlcd AC Adapter 2675 | 2676 | ]]> 2677 | 2678 |
2679 | 2680 | 2681 | The device is "visible" to LCDproc just like any other HD44780 device. The difference 2682 | is the wiring - instead of connecting the display directly to PC (via serial/parallel/usb port), 2683 | it is connected via ethernet and the communication is done over TCP connection. 2684 | The main feature is - that to power and control the LCD is needed single UTP cable. 2685 | To use the driver, specify the device IP address or hostname, on which the ethlcd device 2686 | is accessible by setting in config file the Device value. 2687 | The default is ethlcd. 2688 | 2689 | 2690 |
2691 | 2692 | 2693 | USBLCD adapter 2694 | 2695 | 2696 | The USBLCD adapter from Adams IT Services () 2697 | is a small interface board which allows you to connect an alphanumerical display 2698 | module based on the HD44780 or compatible controller to the USB. The display 2699 | will be powered by the USB. It features a switchable backlight (on or off) and 2700 | can be used with 16x2, 16x4 or 20x4 displays. 2701 | 2702 | 2703 | 2704 | The usblcd connection type communicates with a kernel 2705 | driver by using a device file /dev/usb/lcdx. 2706 | The kernel driver providing this device currently only exists for Linux kernels 2707 | newer than 2.4.20-pre7. 2708 | 2709 | 2710 | 2711 | 2712 | As of 2007 these device are not sold anymore. This driver has been ported from 2713 | lcdproc 0.4.5 to support existing users. 2714 | 2715 | 2716 | 2717 | 2718 | 2719 | USB-4-all controller 2720 | 2721 | 2722 | The USB-4-all controller board from Sprut () 2723 | is a small interface board which allows you to connect different hardware to the USB. 2724 | The subdriver for LCDproc supports dual HD44780 displays and a 4x4 keypad as well as 2725 | software adjustable contrast and brightness (backlight). 2726 | 2727 | 2728 | 2729 | HD44780: USB-4-all - Display connection 2730 | 2731 | 2732 | 2733 | 2734 | 2735 | 2736 | 2737 | USB-4-all 2738 | LCD1 2739 | LCD2 2740 | 2741 | 2742 | name 2743 | pin 2744 | name 2745 | name 2746 | 2747 | 2748 | 2749 | 2750 | RB7 2751 | 28 2752 | D7 2753 | D7 2754 | 2755 | 2756 | RB6 2757 | 27 2758 | D6 2759 | D6 2760 | 2761 | 2762 | RB5 2763 | 26 2764 | D5 2765 | D5 2766 | 2767 | 2768 | RB4 2769 | 25 2770 | D4 2771 | D4 2772 | 2773 | 2774 | RB3 2775 | 24 2776 | R/W 2777 | R/W 2778 | 2779 | 2780 | RB2 2781 | 23 2782 | RS 2783 | RS 2784 | 2785 | 2786 | RB0 2787 | 21 2788 | EN 2789 | 2790 | 2791 | 2792 | RC0 2793 | 11 2794 | 2795 | EN 2796 | 2797 | 2798 | 2799 |
2800 | 2801 | 2802 | HD44780: USB-4-all - Keypad connection 2803 | 2804 | 2805 | 2806 | 2807 | 2808 | 2809 | USB-4-all 2810 | keypad 2811 | 2812 | 2813 | name 2814 | pin 2815 | name 2816 | 2817 | 2818 | 2819 | 2820 | RA0 2821 | 2 2822 | X1 2823 | 2824 | 2825 | RA1 2826 | 3 2827 | X2 2828 | 2829 | 2830 | RA2 2831 | 4 2832 | X3 2833 | 2834 | 2835 | RA3 2836 | 5 2837 | X4 2838 | 2839 | 2840 | RA4 2841 | 6 2842 | Y1 2843 | 2844 | 2845 | RA5 2846 | 7 2847 | Y2 2848 | 2849 | 2850 | RC6 2851 | 17 2852 | Y3 2853 | 2854 | 2855 | RC7 2856 | 18 2857 | Y4 2858 | 2859 | 2860 | 2861 |
2862 | 2863 | 2864 | HD44780: USB-4-all - Brightness and contrast connection 2865 | 2866 | 2867 | 2868 | 2869 | 2870 | 2871 | USB-4-all 2872 | Desc 2873 | 2874 | 2875 | name 2876 | pin 2877 | 2878 | 2879 | 2880 | 2881 | 2882 | RC1 2883 | 12 2884 | brightness 2885 | 2886 | 2887 | RC2 2888 | 13 2889 | contrast 2890 | 2891 | 2892 | 2893 |
2894 | 2895 | 2896 |
2897 | HD44780: USB-4-all brightness control 2898 | 2899 | LCD 15 (+ Backlight) 2914 | 2915 | +---> LCD 16 (- Backlight) 2916 | | 2917 | === GND 2918 | ]]> 2919 | 2920 |
2921 | 2922 |
2923 | HD44780: USB-4-all contrast control 2924 | 2925 | LCD 3 (Contrast) 2934 | |c 680R | 2935 | ___ b |/ |+ 2936 | RC2 o------|___|------| npn --- 10uF 2937 | 22k |\ --- 2938 | |e | 2939 | | | 2940 | | | 2941 | === === GND 2942 | ]]> 2943 | 2944 |
2945 | 2946 |
2947 | 2948 | 2949 | 2950 | Raspberry Pi 2951 | 2952 | This connection type supports a LCD connected to the GPIO header P1 on 2953 | a Raspberry Pi. Displays with one or two controllers are supported. 2954 | 2955 | It supports a switchable backlight connected to pin P1-11 by default. Use 2956 | the switch circuit as described in . 2957 | 2958 | 2959 | The signal level on the GPIO pins is 3.3 V and they are said not to 2960 | be 5 V tolerant. Therefore the R/W pin of the display must 2961 | be wired to GND to prevent 5V logic appearing on the GPIO 2962 | pins. For the same reason the backlight cicuit from must not be 2964 | used. 2965 | Powering a LCD that uses 5 V from pin P1-02 will work. Powering a 2966 | LCD from 3.3 V (pin P1-01) will only work if it is designed for 3.3 V 2967 | operation. 2968 | 2969 | 2970 | 2971 | HD44780: Default pin mapping for Raspberry Pi 2972 | 2973 | 2974 | 2975 | 2976 | 2977 | 2978 | 2979 | 2980 | Connector 2981 | <-> 2982 | LCD 2983 | 2984 | 2985 | Pin Name 2986 | Pin Number 2987 | Name 2988 | Pin 2989 | 2990 | 2991 | 2992 | 2993 | GPIO18 2994 | P1-12 2995 | 2996 | D7 2997 | 14 2998 | 2999 | 3000 | GPIO23 3001 | P1-16 3002 | 3003 | D6 3004 | 13 3005 | 3006 | 3007 | GPIO24 3008 | P1-18 3009 | 3010 | D5 3011 | 12 3012 | 3013 | 3014 | GPIO25 3015 | P1-22 3016 | 3017 | D4 3018 | 11 3019 | 3020 | 3021 | GPIO08 3022 | P1-24 3023 | 3024 | EN 3025 | 6 3026 | 3027 | 3028 | GPIO07 3029 | P1-26 3030 | 3031 | RS 3032 | 4 3033 | 3034 | 3035 | GND 3036 | P1-06 3037 | 3038 | RW 3039 | 5 3040 | 3041 | 3042 | GPIO22 3043 | P1-15 3044 | 3045 | EN2 3046 | Second controller (optional) 3047 | 3048 | 3049 | GPIO17 3050 | P1-11 3051 | 3052 | BL 3053 | Backlight (optional) 3054 | 3055 | 3056 | 3057 |
3058 | 3059 | GPIO07 and GPIO08 used for RS and EN signal are also used by the SPI 3060 | bus. If you loaded the SPI driver you will need to assign them to a different 3061 | GPIO, e.g. GPIO04 and GPIO22. 3062 | 3063 | When using a display with two controllers the vspan 3064 | option has to be configured as well (e.g. vspan=2,2 for a 3065 | 40x4 display). 3066 | 3067 | 3068 | Special Raspberry Pi configuration options 3069 | 3070 | This connection driver can be configured to use other pins than the 3071 | one described in the table 3072 | above. Using the pin_<LCD pin name> 3073 | configuration option, any LCD pin can be assigned 3074 | to any GPIO pin. 3075 | 3076 | 3077 | The values for the pin_<LCD pin name> 3078 | configuration option are the number part from the 3079 | GPIO signal name, not the pin number from the header connector! To find 3080 | out which signal is routed to which connector pin refer to the RPi Low-level peripherals 3082 | description. 3083 | 3084 | 3085 | The connection driver contains a check for possible signal names. You 3086 | will receive an error message if you try to assign a pin to a signal that is 3087 | not available on connector P1 or P5. 3088 | 3089 | 3090 | HD44780: Alternate configuration for Raspberry Pi GPIO pins 3091 | 3092 | 3107 | 3108 | 3109 | 3110 | 3111 |
3112 | 3113 | 3114 | Adafruit Pi Plate 3115 | 3116 | 3117 | The Adafruit RGB Positive 16x2 LCD+Keypad for Raspberry Pi (aka Pi Plate, 3118 | see ()) combines 3119 | a 16x2 Character LCD, up to 3 backlight pins AND 5 keypad pins using only 3120 | the two I2C pins on the Rasperry Pi. 3121 | 3122 | 3123 | 3124 | Note that this connection type drives all RGB pins of the backlight at the 3125 | same time, resulting in a white backlight. You will need to modify the 3126 | source code if you want to have some other color. 3127 | 3128 | 3129 | 3130 | HD44780: Configuration example for Pi Plate connection type 3131 | 3132 | 3147 | 3148 | 3149 | 3150 | 3151 | 3152 | 3153 | PiFace Control and Display 3154 | 3155 | 3156 | The PiFace Control and Display for Raspberry Pi 3157 | from OpenLX SP Ltd combines a 16x2 Character LCD and navigation buttons using 3158 | the SPI bus on the Rasperry Pi. 3159 | 3160 | 3161 | 3162 | 3163 | The PiFace Control and Display features a IR receiver, which LCDproc does not 3164 | make use of. You have to setup and use LIRC for that. See 3165 | 3166 | Setting up PiFace Control And Display to use a remote. 3167 | 3168 | 3169 | 3170 | 3171 | HD44780: Configuration example for PiFace Control and Display connection type 3172 | 3173 | 3190 | 3191 | 3192 | 3193 | 3194 | 3195 |
3196 | 3197 | 3198 | 3199 | Compiling 3200 | 3201 | 3202 | Make sure that the HD44780 files are built when you run ./configure. 3203 | This can be done by specifying or by including 3204 | hd44780 in the list of enabled drivers 3205 | (e.g. ). 3206 | 3207 | 3208 | 3209 | 3210 | 3211 | 3212 | 3213 | Configuration in LCDd.conf 3214 | 3215 | 3216 | [hd44780] 3217 | 3218 | 3219 | 3220 | 3221 | Port = 3222 | PORT 3223 | 3224 | 3225 | For parallel connections, specify the address of the parallel port the LCD is connected to. 3226 | Common values for PORT are 0x278, 3227 | 0x378 and 0x3BC. 3228 | If not given, the default is 0x378. 3229 | 3230 | For I2C connection types this sets the slave 3231 | address. 3232 | 3233 | 3234 | 3235 | 3236 | 3237 | Device = 3238 | DEVICE 3239 | 3240 | 3241 | If you are using a serial or I2C connection, 3242 | you need to set this parameter to the device your LCD is connected to. 3243 | For example, if the display is connected to the first serial port, 3244 | you have to set it to /dev/ttyS0. 3245 | The default value is /dev/lcd. 3246 | 3247 | 3248 | 3249 | 3250 | 3251 | ConnectionType = 3252 | { 3253 | 3254 | 4bit | 3255 | 8bit | 3256 | serialLpt | 3257 | winamp | 3258 | picanlcd | 3259 | lcdserializer | 3260 | los-panel | 3261 | vdr-lcd | 3262 | vdr-wakeup | 3263 | pertelian | 3264 | lis2 | 3265 | mplay | 3266 | usblcd | 3267 | bwctusb | 3268 | lcd2usb | 3269 | usbtiny | 3270 | uss720 | 3271 | usb4all | 3272 | ftdi | 3273 | i2c | 3274 | piplate | 3275 | spi | 3276 | pifacecad | 3277 | ethlcd | 3278 | raspberrypi 3279 | } 3280 | 3281 | 3282 | 3283 | Select the type of the wiring / display connection. See also 3284 | (). 3285 | 3286 | 3287 | 3288 | 3289 | 3290 | 3291 | Speed = 3292 | BITRATE 3293 | 3294 | 3295 | For a serial connection, set to the serial port bitrate. To use 3296 | the default value for the chosen interface, just set to 0. 3297 | 3298 | 3299 | 3300 | 3301 | 3302 | CharMap = 3303 | { 3304 | hd44780_default | 3305 | hd44780_euro | 3306 | ea_ks0073 | 3307 | sed12780f_0b | 3308 | hd44780_koi8_r | 3309 | hd44780_cp1251 | 3310 | hd44780_8859_5 | 3311 | upd16314 | 3312 | none 3313 | } 3314 | 3315 | 3316 | 3317 | Set the character mapping depending on the display you have: 3318 | 3319 | 3320 | The default, hd44780_default, is for "classic" 3321 | HD44780 displays. 3322 | 3323 | 3324 | hd44780_euro is for displays with a ROM mask 3325 | supporting the european charset (ROM code A02). 3326 | 3327 | 3328 | ea_ks0073 is the charmap for Electronic 3329 | Assembly's KS0073 based displays. These devices have a richer 3330 | charset, including many icons and many more characters of the 3331 | ISO-8859-1 than standard HD44780s. 3332 | 3333 | 3334 | sed12780f_0b is for some SED 1278 displays. 3335 | 3336 | 3337 | The none charmap does not translate any characters. 3338 | It displays the characters the display controllers actually has 3339 | stored in its CGROM for that position instead. This setting is 3340 | intended for debugging purpose. 3341 | 3342 | 3343 | You only need to set this parameter if you have a non-standard 3344 | HD44780 display or charmap. 3345 | 3346 | 3347 | If LCDproc was configured with '--enable-extra-charmaps' option the 3348 | following character mappings are available, too: 3349 | 3350 | 3351 | hd44780_koi8_r maps input from a client in 3352 | Russian KOI8-R to displays with a ROM mask supporting the european 3353 | charset (ROM code A02). 3354 | 3355 | 3356 | hd44780_cp1251 maps input from a client in 3357 | Russian CP1251 (Windows-1251) to displays with a ROM mask supporting 3358 | the european charset (ROM code A02). 3359 | 3360 | 3361 | hd44780_8859_5 maps input from a client in 3362 | Russian ISO 8859-5 to displays with a ROM mask supporting the european 3363 | charset (ROM code A02). 3364 | 3365 | 3366 | upd16314 is for displays with a Nec uPD16314 3367 | vacuum fluorescent display (VFD) controller with ROM code 002 3368 | character set. If your display has ROM code 001 character set you 3369 | may use the hd44780_euro charmap instead. 3370 | 3371 | 3372 | 3373 | 3374 | 3375 | See server/drivers/hd44780-charset.h 3376 | in LCDproc's source directory for the actual 3377 | mappings. 3378 | 3379 | 3380 | 3381 | 3382 | 3383 | 3384 | 3385 | Keypad = ¶meters.yesnodef; 3386 | 3387 | 3388 | Tell whether you have a keypad connected. 3389 | You may also need to configure the keypad layout further on in this file. 3390 | 3391 | 3392 | 3393 | 3394 | 3395 | Brightness = 3396 | BRIGHTNESS 3397 | 3398 | 3399 | Set the initial brightness when the backlight is on 3400 | for the lcd2usb connection type. 3401 | Legal values are 0 - 1000, 3402 | with 800 being the default. 3403 | 3404 | 3405 | 3406 | 3407 | 3408 | OffBrightness = 3409 | BRIGHTNESS 3410 | 3411 | 3412 | Set the initial off-brightness, i.e. the brightness when the backlight is off, 3413 | for the lcd2usb connection type. 3414 | The legal range is 0 - 1000. 3415 | If not given, it defaults to 300. 3416 | 3417 | 3418 | 3419 | 3420 | 3421 | Contrast = 3422 | CONTRAST 3423 | 3424 | 3425 | Set the initial contrast for the bwctusb and 3426 | lcd2usb connection types. 3427 | Legal values for CONTRAST are 3428 | 0 - 1000. 3429 | If not given, it defaults to 500 which may 3430 | be too low or too high for the selected connection type. 3431 | So, if the screen is blank or dark, please try playing with 3432 | the contrast a bit. 3433 | 3434 | 3435 | 3436 | 3437 | 3438 | Backlight = ¶meters.yesnodef; 3439 | 3440 | 3441 | Specify if you have a switchable backlight. 3442 | 3443 | 3444 | 3445 | 3446 | 3447 | OutputPort = ¶meters.yesnodef; 3448 | 3449 | 3450 | Tell if you have the additional output port ("bargraph") and you want to 3451 | be able to control it with the lcdproc OUTPUT command. 3452 | 3453 | 3454 | 3455 | 3456 | 3457 | Lastline = ¶meters.yesdefno; 3458 | 3459 | 3460 | Specifies whether the lowest pixel line of a character is pixel addressable 3461 | or if it controls an underline effect. 3462 | The default is yes, meaning a pixel addressable last pixel line. 3463 | 3464 | 3465 | 3466 | 3467 | 3468 | Size = ¶meters.size; 3469 | 3470 | 3471 | Specifies the size of the LCD. 3472 | Default: 20x4 3473 | In case of multiple combined displays, this should be the total size. 3474 | 3475 | 3476 | 3477 | 3478 | 3479 | vSpan = 3480 | 3481 | HEIGHT 3482 | ,… 3483 | 3484 | 3485 | 3486 | The "vertical span" when using the driver with multi-controller displays 3487 | or with multiple displays that are treated as a single virtual display. 3488 | It is a comma separated list of the heights of each display. 3489 | In multi-controller displays it lists the number of lines each controller 3490 | is responsible for. 3491 | 3492 | 3493 | E.g. vSpan=2,2,1 means you have three physical displays, the first 3494 | two having two lines each, and the third having one line, that together form 3495 | a virtual display that is 5 lines high. 3496 | 3497 | 3498 | The sum of the HEIGHTs must match the total height 3499 | given in Size=. 3500 | 3501 | 3502 | 3503 | 3504 | 3505 | ExtendedMode = ¶meters.yesnodef; 3506 | 3507 | 3508 | If you have a KS0073 or an other 'almost HD44780-compatible', set this 3509 | flag to get into extended,4-line linear addressing mode. 3510 | 3511 | 3512 | 3513 | 3514 | 3515 | LineAddress = 3516 | ADDR 3517 | 3518 | 3519 | If the next line of your display doesn't start 0x20 higher in 3520 | DDRAM you can override the default value of the ExtendedMode with this parameter. 3521 | 3522 | 3523 | 3524 | 3525 | 3526 | DelayMult = 3527 | DELAY 3528 | 3529 | 3530 | If your display is slow and cannot keep up with the flow of data from 3531 | LCDd, garbage can appear on the LCDd. Set this delay multiplier to 3532 | 2 or 4 to increase the delays. 3533 | The default is 1 for a non-multiplied delay. 3534 | 3535 | 3536 | 3537 | 3538 | 3539 | DelayBus = ¶meters.yesdefno; 3540 | 3541 | 3542 | You can reduce the inserted delays by setting this to no. 3543 | On fast PCs it is possible your LCD does not respond correctly. 3544 | Default: yes. 3545 | 3546 | 3547 | 3548 | 3549 | 3550 | KeepAliveDisplay = 3551 | SECONDS 3552 | 3553 | 3554 | Some displays (e.g. vdr-wakeup) need a message from the driver to 3555 | indicate that it is still alive. 3556 | When set to a value greater than 0 the character in the 3557 | upper left corner is updated every SECONDS seconds. 3558 | The default 0 does not cause any extra updates. 3559 | 3560 | 3561 | 3562 | 3563 | 3564 | RefreshDisplay = 3565 | SECONDS 3566 | 3567 | 3568 | If you experience occasional garbage on your display you can use this 3569 | option as workaround. If set to a value greater than 0 it forces a 3570 | full screen refresh every SECONDS seconds. 3571 | Default: 0. 3572 | 3573 | 3574 | 3575 | 3576 | 3577 | KeyDirect_NUM = 3578 | KEY 3579 | 3580 | 3581 | KeyMatrix_X_Y = 3582 | KEY 3583 | 3584 | 3585 | 3586 | If you have a keypad you can assign keystrings to the keys. 3587 | See the keypad section 3588 | for used terms and the section on the specific connection type how to 3589 | wire it. 3590 | 3591 | 3592 | To map, for example, the directly connected key 4 3593 | to the string Enter, use KeyDirect_4=Enter. 3594 | For matrix keys use the X and 3595 | Y coordinates of the key; 3596 | e.g. KeyMatrix_1_3=Enter. 3597 | 3598 | 3599 | 3600 | 3601 | 3602 | 3603 | VendorID = 3604 | VENDORID 3605 | 3606 | 3607 | USB vendor ID to look for in certain USB connection types. 3608 | When using an FTDI chip with connection type ftdi, the default value is 3609 | 0x4003. 3610 | When using a USS720 chip with connection type uss720, the default value is 3611 | 0x1293. 3612 | 3613 | 3614 | 3615 | 3616 | 3617 | ProductID = 3618 | PRODUCTID 3619 | 3620 | 3621 | USB product ID to look for in certain USB connection types. 3622 | When using an FTDI chip with connection type ftdi, the default value is 3623 | 0x6001. 3624 | When using a USS720 chip with connection type uss720, the default value is 3625 | 0x0002. 3626 | 3627 | 3628 | 3629 | 3630 | 3631 | SerialNumber = 3632 | SERIALNO 3633 | 3634 | 3635 | Serial number of the USB device to look for with 3636 | connection type bwctusb. 3637 | If not given, the first BWCT USB module found will be used. 3638 | 3639 | 3640 | 3641 | 3642 | 3643 | 3644 | 3645 | 3646 | 3647 | 3648 | Miscellanea 3649 | 3650 | 3651 | This text has originally been taken from a message by Bill Farrow 3652 | bfarrow@arrow.bsee.swin.edu.au. 3653 | 3654 | 3655 | 3656 | Updated February 2000, Benjamin Tse blt@ComPorts.com 3657 | 3658 | 3659 | 3660 | Updated October 2001, Joris Robijn joris@robijn.net 3661 | 3662 | 3663 | 3664 | Converted to Docbook March 2002, Rene Wagner reenoo@gmx.de 3665 | 3666 | 3667 | 3668 | Updated April 2002, Rene Wagner reenoo@gmx.de 3669 | 3670 | 3671 | 3672 | Updated and extended April 2006 to November 2007, Peter Marschall peter@adpm.de 3673 | 3674 | 3675 | 3676 | 3677 |
3678 | -------------------------------------------------------------------------------- /hd44780.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilberforce/lcdproc/3753e21c231113daf008059dcfb3c5ae705753ea/hd44780.so -------------------------------------------------------------------------------- /server/drivers/hd44780-i2c.c: -------------------------------------------------------------------------------- 1 | /** \file server/drivers/hd44780-i2c.c 2 | * \c i2c connection type of \c hd44780 driver for Hitachi HD44780 based LCD displays. 3 | * 4 | * The LCD is operated in its 4 bit-mode to be connected to the 8 bit-port 5 | * of a single PCF8574(A) or PCA9554(A) that is accessed by the server via the i2c bus. 6 | */ 7 | 8 | /* Copyright (c) 2005 Matthias Goebl 9 | * 2000, 1999, 1995 Benjamin Tse 10 | * 2001 Joris Robijn 11 | * 1999 Andrew McMeikan 12 | * 1998 Richard Rognlie 13 | * 1997 Matthias Prinke 14 | * 15 | * The connections are: 16 | * PCF8574AP Bit LCD 17 | * P0 (4) 0x01 D4 (11) 18 | * P1 (5) 0x02 D5 (12) 19 | * P2 (6) 0x04 D6 (13) 20 | * P3 (7) 0x08 D7 (14) 21 | * P4 (9) 0x10 RS (4) 22 | * P5 (10) 0x20 RW (5) 23 | * P6 (11) 0x40 EN (6) 24 | * P7 (12) 0x80 /backlight (optional, active-low) 25 | * 26 | * Configuration: 27 | \verbatim 28 | alternative wiring example: 29 | PCF8574AP: P0 P1 P2 P3 P4 P5 P6 P7 30 | | | | | | | | | 31 | HD44780: RS RW EN BL D4 D5 D6 D7 32 | 33 | in LCDd.conf we then need to define 34 | i2c_line_RS=0x01 35 | i2c_line_RW=0x02 36 | i2c_line_EN=0x04 37 | i2c_line_BL=0x80 38 | i2c_line_D4=0x10 39 | i2c_line_D5=0x20 40 | i2c_line_D6=0x40 41 | i2c_line_D7=0x80 42 | Backlight=yes 43 | BacklightInvert=yes 44 | 45 | The Backlight Invert is used if a 0 turns the backlight on, and 1 turns it off, i.e. npn transistor 46 | \endverbatim 47 | 48 | * 49 | * Configuration: 50 | * device=/dev/i2c-0 # the device file of the i2c bus 51 | * port=0x20 # the i2c address of the i2c port expander 52 | * 53 | * Attention: Bit 8 of the address given in port is special: 54 | * It tells the driver to treat the device as PCA9554 or similar, 55 | * a device that needs a 2-byte command, and it will be stripped 56 | * off the address. 57 | * So we have: 58 | * port=0x20..0x27 PCF8574 with A[012]=0..7 59 | * port=0x38..0x3f PCF8574A with A[012]=0..7 60 | * port=0xa0..0xa7 PCA9554 with A[012]=0..7 61 | * port=0xa0..0xa7 PCA9554A with A[012]=0..7 62 | * 63 | * When using this driver, DON'T load the i2c chip module (e.g. pcf8574), 64 | * you only need the i2c bus driver module! 65 | * 66 | * 67 | * Based mostly on the hd44780-4bit module, see there for a complete history. 68 | * Suggestions for PCA9554 support from Tonu Samuel . 69 | * 70 | * This file is released under the GNU General Public License. Refer to the 71 | * COPYING file distributed with this package. 72 | */ 73 | 74 | #include "hd44780-i2c.h" 75 | #include "hd44780-low.h" 76 | 77 | #include "report.h" 78 | #ifdef HAVE_CONFIG_H 79 | # include "config.h" 80 | #endif 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | 88 | #ifdef HAVE_DEV_IICBUS_IIC_H 89 | #include 90 | #else /* HAVE_LINUX_I2C_DEV_H */ 91 | #include 92 | /* I2C_SLAVE is missing in linux/i2c-dev.h from kernel headers of 2.4.x kernels */ 93 | #ifndef I2C_SLAVE 94 | #define I2C_SLAVE 0x0703 /* Change slave address */ 95 | #endif 96 | #endif 97 | 98 | 99 | // Generally, any function that accesses the LCD control lines needs to be 100 | // implemented separately for each HW design. This is typically (but not 101 | // restricted to): 102 | // HD44780_senddata 103 | // HD44780_readkeypad 104 | 105 | void i2c_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch); 106 | void i2c_HD44780_backlight(PrivateData *p, unsigned char state); 107 | void i2c_HD44780_close(PrivateData *p); 108 | 109 | #define RS 0x10 110 | #define RW 0x20 111 | #define EN 0x40 112 | #define BL 0x80 113 | #define D4 0x01 114 | #define D5 0x02 115 | #define D6 0x04 116 | #define D7 0x08 117 | #define BL_INVERT 0 118 | // note that the above bits are all meant for the data port of PCF8574 119 | 120 | #define I2C_ADDR_MASK 0x7f 121 | #define I2C_PCAX_MASK 0x80 122 | 123 | static void 124 | i2c_out(PrivateData *p, unsigned char val) 125 | { 126 | char data[2]; 127 | int datalen; 128 | static int no_more_errormsgs=0; 129 | #ifdef HAVE_DEV_IICBUS_IIC_H 130 | struct iiccmd cmd; 131 | bzero(&cmd, sizeof(cmd)); 132 | #endif 133 | 134 | if (p->port & I2C_PCAX_MASK) { // we have a PCA9554 or similar, that needs a 2-byte command 135 | data[0]=1; // command: read/write output port register 136 | data[1]=val; 137 | datalen=2; 138 | } else { // we have a PCF8574 or similar, that needs a 1-byte command 139 | data[0]=val; 140 | datalen=1; 141 | } 142 | 143 | #ifdef HAVE_DEV_IICBUS_IIC_H 144 | cmd.slave = (p->port & I2C_ADDR_MASK) << 1; 145 | cmd.last = 1; 146 | cmd.count = datalen; 147 | cmd.buf = data; 148 | 149 | if (ioctl(p->fd, I2CWRITE, &cmd) < 0) { 150 | #else /* HAVE_LINUX_I2C_DEV_H */ 151 | if (write(p->fd,data,datalen) != datalen) { 152 | #endif 153 | p->hd44780_functions->drv_report(no_more_errormsgs?RPT_DEBUG:RPT_ERR, "HD44780: I2C: i2c write data %u to address 0x%02X failed: %s", 154 | val, p->port & I2C_ADDR_MASK, strerror(errno)); 155 | no_more_errormsgs=1; 156 | } 157 | } 158 | 159 | #define DEFAULT_DEVICE "/dev/i2c-0" 160 | 161 | 162 | /** 163 | * Initialize the driver. 164 | * \param drvthis Pointer to driver structure. 165 | * \retval 0 Success. 166 | * \retval -1 Error. 167 | */ 168 | int 169 | hd_init_i2c(Driver *drvthis) 170 | { 171 | PrivateData *p = (PrivateData*) drvthis->private_data; 172 | HD44780_functions *hd44780_functions = p->hd44780_functions; 173 | 174 | p->i2c_backlight_invert = drvthis->config_get_bool(drvthis->name, "BacklightInvert", 0, BL_INVERT); 175 | p->i2c_line_RS = drvthis->config_get_int(drvthis->name, "i2c_line_RS", 0, RS); 176 | p->i2c_line_RW = drvthis->config_get_int(drvthis->name, "i2c_line_RW", 0, RW); 177 | p->i2c_line_EN = drvthis->config_get_int(drvthis->name, "i2c_line_EN", 0, EN); 178 | p->i2c_line_BL = drvthis->config_get_int(drvthis->name, "i2c_line_BL", 0, BL); 179 | p->i2c_line_D4 = drvthis->config_get_int(drvthis->name, "i2c_line_D4", 0, D4); 180 | p->i2c_line_D5 = drvthis->config_get_int(drvthis->name, "i2c_line_D5", 0, D5); 181 | p->i2c_line_D6 = drvthis->config_get_int(drvthis->name, "i2c_line_D6", 0, D6); 182 | p->i2c_line_D7 = drvthis->config_get_int(drvthis->name, "i2c_line_D7", 0, D7); 183 | 184 | report(RPT_INFO, "HD44780: I2C: Init using D4 and D5, and or'd lines, invert", p->i2c_line_RS); 185 | report(RPT_INFO, "HD44780: I2C: Pin RS mapped to 0x%02X", p->i2c_line_RS); 186 | report(RPT_INFO, "HD44780: I2C: Pin RW mapped to 0x%02X", p->i2c_line_RW); 187 | report(RPT_INFO, "HD44780: I2C: Pin EN mapped to 0x%02X", p->i2c_line_EN); 188 | report(RPT_INFO, "HD44780: I2C: Pin BL mapped to 0x%02X", p->i2c_line_BL); 189 | report(RPT_INFO, "HD44780: I2C: Pin D4 mapped to 0x%02X", p->i2c_line_D4); 190 | report(RPT_INFO, "HD44780: I2C: Pin D5 mapped to 0x%02X", p->i2c_line_D5); 191 | report(RPT_INFO, "HD44780: I2C: Pin D6 mapped to 0x%02X", p->i2c_line_D6); 192 | report(RPT_INFO, "HD44780: I2C: Pin D7 mapped to 0x%02X", p->i2c_line_D7); 193 | report(RPT_INFO, "HD44780: I2C: Invert Backlight %d", p->i2c_backlight_invert); 194 | 195 | char device[256] = DEFAULT_DEVICE; 196 | #ifdef HAVE_DEV_IICBUS_IIC_H 197 | struct iiccmd cmd; 198 | bzero(&cmd, sizeof(cmd)); 199 | #endif 200 | 201 | p->backlight_bit = p->i2c_line_BL; 202 | 203 | /* READ CONFIG FILE */ 204 | 205 | /* Get serial device to use */ 206 | strncpy(device, drvthis->config_get_string(drvthis->name, "Device", 0, DEFAULT_DEVICE), sizeof(device)); 207 | device[sizeof(device)-1] = '\0'; 208 | report(RPT_INFO,"HD44780: I2C: Using device '%s' and address 0x%02X for a %s", 209 | device, p->port & I2C_ADDR_MASK, (p->port & I2C_PCAX_MASK) ? "PCA9554(A)" : "PCF8574(A)"); 210 | 211 | // Open the I2C device 212 | p->fd = open(device, O_RDWR); 213 | if (p->fd < 0) { 214 | report(RPT_ERR, "HD44780: I2C: open i2c device '%s' failed: %s", device, strerror(errno)); 215 | return(-1); 216 | } 217 | 218 | // Set I2C address 219 | #ifdef HAVE_DEV_IICBUS_IIC_H 220 | cmd.slave = (p->port & I2C_ADDR_MASK) << 1; 221 | cmd.last = 0; 222 | cmd.count = 0; 223 | if (ioctl(p->fd, I2CRSTCARD, &cmd) < 0) { 224 | report(RPT_ERR, "HD44780: I2C: reset bus failed: %s", strerror(errno)); 225 | return -1; 226 | } 227 | if (ioctl(p->fd, I2CSTART, &cmd) < 0) { 228 | report(RPT_ERR, "HD44780: I2C: set address to 0x%02X: %s", p->port & I2C_ADDR_MASK, strerror(errno)); 229 | return -1; 230 | } 231 | #else /* HAVE_LINUX_I2C_DEV_H */ 232 | if (ioctl(p->fd,I2C_SLAVE, p->port & I2C_ADDR_MASK) < 0) { 233 | report(RPT_ERR, "HD44780: I2C: set address to '%i': %s", p->port & I2C_ADDR_MASK, strerror(errno)); 234 | return(-1); 235 | } 236 | #endif 237 | 238 | if (p->port & I2C_PCAX_MASK) { // we have a PCA9554 or similar, that needs special config 239 | char data[2]; 240 | data[0] = 2; // command: set polarity inversion 241 | data[1] = 0; // -> no polarity inversion 242 | if (write(p->fd,data,2) != 2) { 243 | report(RPT_ERR, "HD44780: I2C: i2c set polarity inversion failed: %s", strerror(errno)); 244 | } 245 | data[0] = 3; // command: set output direction 246 | data[1] = 0; // -> all pins are outputs 247 | if (write(p->fd,data,2) != 2) { 248 | report(RPT_ERR, "HD44780: I2C: i2c set output direction failed: %s", strerror(errno)); 249 | } 250 | } 251 | 252 | hd44780_functions->senddata = i2c_HD44780_senddata; 253 | hd44780_functions->backlight = i2c_HD44780_backlight; 254 | hd44780_functions->close = i2c_HD44780_close; 255 | 256 | // powerup the lcd now 257 | /* We'll now send 0x03 a couple of times, 258 | * which is in fact (FUNCSET | IF_8BIT) >> 4 259 | */ 260 | i2c_out(p, p->i2c_line_D4 | p->i2c_line_D5); 261 | if (p->delayBus) 262 | hd44780_functions->uPause(p, 1); 263 | 264 | i2c_out(p, p->i2c_line_EN | p->i2c_line_D4 | p->i2c_line_D5); 265 | if (p->delayBus) 266 | hd44780_functions->uPause(p, 1); 267 | i2c_out(p, p->i2c_line_D4 | p->i2c_line_D5); 268 | hd44780_functions->uPause(p, 15000); 269 | 270 | i2c_out(p, p->i2c_line_EN | p->i2c_line_D4 | p->i2c_line_D5); 271 | if (p->delayBus) 272 | hd44780_functions->uPause(p, 1); 273 | i2c_out(p, p->i2c_line_D4 | p->i2c_line_D5); 274 | hd44780_functions->uPause(p, 5000); 275 | 276 | i2c_out(p, p->i2c_line_EN | p->i2c_line_D4 | p->i2c_line_D5); 277 | if (p->delayBus) 278 | hd44780_functions->uPause(p, 1); 279 | i2c_out(p, p->i2c_line_D4 | p->i2c_line_D5); 280 | hd44780_functions->uPause(p, 100); 281 | 282 | i2c_out(p, p->i2c_line_EN | p->i2c_line_D4 | p->i2c_line_D5); 283 | if (p->delayBus) 284 | hd44780_functions->uPause(p, 1); 285 | i2c_out(p, p->i2c_line_D4 | p->i2c_line_D5); 286 | hd44780_functions->uPause(p, 100); 287 | 288 | // now in 8-bit mode... set 4-bit mode 289 | /* 290 | OLD (FUNCSET | IF_4BIT) >> 4 0x02 291 | ALT (FUNCSET | IF_4BIT) 0x20 292 | */ 293 | i2c_out(p, p->i2c_line_D5); 294 | if (p->delayBus) 295 | hd44780_functions->uPause(p, 1); 296 | 297 | i2c_out(p, p->i2c_line_EN | p->i2c_line_D5); 298 | if (p->delayBus) 299 | hd44780_functions->uPause(p, 1); 300 | i2c_out(p, p->i2c_line_D5); 301 | hd44780_functions->uPause(p, 100); 302 | 303 | // Set up two-line, small character (5x8) mode 304 | hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_4BIT | TWOLINE | SMALLCHAR); 305 | hd44780_functions->uPause(p, 40); 306 | 307 | common_init(p, IF_4BIT); 308 | 309 | return 0; 310 | } 311 | 312 | void 313 | i2c_HD44780_close(PrivateData *p) { 314 | if (p->fd >= 0) { 315 | #ifdef HAVE_DEV_IICBUS_IIC_H 316 | ioctl(p->fd, I2CSTOP); 317 | #endif 318 | close(p->fd); 319 | } 320 | } 321 | 322 | 323 | /** 324 | * Send data or commands to the display. 325 | * \param p Pointer to driver's private data structure. 326 | * \param displayID ID of the display (or 0 for all) to send data to. 327 | * \param flags Defines whether to end a command or data. 328 | * \param ch The value to send. 329 | */ 330 | void 331 | i2c_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch) 332 | { 333 | unsigned char portControl = 0; 334 | unsigned char h=0; 335 | unsigned char l=0; 336 | if( ch & 0x80 ) h |= p->i2c_line_D7; 337 | if( ch & 0x40 ) h |= p->i2c_line_D6; 338 | if( ch & 0x20 ) h |= p->i2c_line_D5; 339 | if( ch & 0x10 ) h |= p->i2c_line_D4; 340 | if( ch & 0x08 ) l |= p->i2c_line_D7; 341 | if( ch & 0x04 ) l |= p->i2c_line_D6; 342 | if( ch & 0x02 ) l |= p->i2c_line_D5; 343 | if( ch & 0x01 ) l |= p->i2c_line_D4; 344 | if (flags == RS_INSTR) 345 | portControl = 0; 346 | else //if (flags == RS_DATA) 347 | portControl = p->i2c_line_RS; 348 | 349 | portControl |= p->backlight_bit; 350 | 351 | i2c_out(p, portControl | h); 352 | if (p->delayBus) 353 | p->hd44780_functions->uPause(p, 1); 354 | i2c_out(p, p->i2c_line_EN | portControl | h); 355 | if (p->delayBus) 356 | p->hd44780_functions->uPause(p, 1); 357 | i2c_out(p, portControl | h); 358 | 359 | i2c_out(p, portControl | l); 360 | if (p->delayBus) 361 | p->hd44780_functions->uPause(p, 1); 362 | i2c_out(p, p->i2c_line_EN | portControl | l); 363 | if (p->delayBus) 364 | p->hd44780_functions->uPause(p, 1); 365 | i2c_out(p, portControl | l); 366 | } 367 | 368 | 369 | /** 370 | * Turn display backlight on or off. 371 | * \param p Pointer to driver's private data structure. 372 | * \param state New backlight status. 373 | */ 374 | void i2c_HD44780_backlight(PrivateData *p, unsigned char state) 375 | { 376 | if ( p->i2c_backlight_invert == 0 ) 377 | p->backlight_bit = ((!p->have_backlight||state) ? 0 : p->i2c_line_BL); 378 | else // Inverted backlight - npn transistor 379 | p->backlight_bit = ((p->have_backlight && state) ? p->i2c_line_BL : 0); 380 | i2c_out(p, p->backlight_bit); 381 | } 382 | -------------------------------------------------------------------------------- /server/drivers/hd44780-low.h: -------------------------------------------------------------------------------- 1 | /** \file server/drivers/hd44780-low.h 2 | * Interface to low level code to export from hd44780.c to "lower" hardware 3 | * implementation dependent files. 4 | */ 5 | 6 | #ifndef HD_LOW_H 7 | #define HD_LOW_H 8 | 9 | #ifdef HAVE_CONFIG_H 10 | # include "config.h" 11 | #endif 12 | 13 | #ifdef HAVE_LIBUSB 14 | # include 15 | #endif 16 | 17 | #if TIME_WITH_SYS_TIME 18 | # include 19 | # include 20 | #else 21 | # if HAVE_SYS_TIME_H 22 | # include 23 | # else 24 | # include 25 | # endif 26 | #endif 27 | 28 | #ifdef HAVE_LIBFTDI 29 | # include 30 | #endif 31 | 32 | /** \name Symbolic names for connection types 33 | *@{*/ 34 | #define HD44780_CT_UNKNOWN 0 35 | #define HD44780_CT_4BIT 1 36 | #define HD44780_CT_8BIT 2 37 | #define HD44780_CT_SERIALLPT 3 38 | #define HD44780_CT_WINAMP 4 39 | #define HD44780_CT_PICANLCD 5 40 | #define HD44780_CT_LCDSERIALIZER 6 41 | #define HD44780_CT_LOS_PANEL 7 42 | #define HD44780_CT_VDR_LCD 8 43 | #define HD44780_CT_VDR_WAKEUP 9 44 | #define HD44780_CT_PERTELIAN 10 45 | #define HD44780_CT_LIS2 11 46 | #define HD44780_CT_MPLAY 12 47 | #define HD44780_CT_BWCTUSB 13 48 | #define HD44780_CT_LCD2USB 14 49 | #define HD44780_CT_FTDI 15 50 | #define HD44780_CT_I2C 16 51 | #define HD44780_CT_ETHLCD 17 52 | #define HD44780_CT_USS720 18 53 | #define HD44780_CT_USBLCD 19 54 | #define HD44780_CT_USBTINY 20 55 | #define HD44780_CT_USB4ALL 21 56 | #define HD44780_CT_RASPBERRYPI 22 57 | #define HD44780_CT_PIPLATE 23 58 | #define HD44780_CT_SPI 24 59 | #define HD44780_CT_PIFACECAD 25 60 | /**@}*/ 61 | 62 | /** \name Symbolic names for interface types 63 | *@{*/ 64 | #define IF_TYPE_UNKNOWN 0 65 | #define IF_TYPE_PARPORT 1 66 | #define IF_TYPE_SERIAL 2 67 | #define IF_TYPE_USB 3 68 | #define IF_TYPE_I2C 4 69 | #define IF_TYPE_TCP 5 70 | #define IF_TYPE_SPI 6 71 | /**@}*/ 72 | 73 | /** \name Symbolic default values 74 | *@{*/ 75 | #define DEFAULT_CONTRAST 800 76 | #define DEFAULT_BRIGHTNESS 800 77 | #define DEFAULT_OFFBRIGHTNESS 300 78 | /**@}*/ 79 | 80 | /** \name Maximum sizes of the keypad 81 | *@{*/ 82 | /* DO NOT CHANGE THESE VALUES, unless you change the functions too! */ 83 | #define KEYPAD_MAXX 5 84 | #define KEYPAD_MAXY 11 85 | /**@}*/ 86 | 87 | /** number of custom characters */ 88 | #define NUM_CCs 8 89 | 90 | /** 91 | * One entry of the custom character cache consists of 8 bytes of cache data 92 | * and a clean flag. 93 | */ 94 | typedef struct cgram_cache { 95 | unsigned char cache[LCD_DEFAULT_CELLHEIGHT]; 96 | int clean; 97 | } CGram; 98 | 99 | 100 | /** 101 | * Provides necessary data to initialize a connection type (sub-driver). 102 | */ 103 | typedef struct ConnectionMapping { 104 | /** Name (string) of connection type as used in LCDd.conf */ 105 | char *name; 106 | /** Registered number of connection type, see above */ 107 | int connectiontype; 108 | /** Numeric type (serial, parallel, etc), see above */ 109 | int if_type; 110 | /** Pointer to connection type's initialization function */ 111 | int (*init_fn) (Driver *drvthis); 112 | } ConnectionMapping; 113 | 114 | 115 | /** 116 | * Transmit buffer. This structure provides a generic transmit buffer for 117 | * collecting command or data bytes before sending them to the display. The 118 | * connection driver is responsible for allocating memory and resetting 119 | * \c use_count. \c type may also be driver dependent. 120 | */ 121 | typedef struct tx_buffer_t { 122 | unsigned char *buffer; /**< Pointer to buffer */ 123 | int type; /**< Data or Command indicator */ 124 | int use_count; /**< Number of currently used bytes */ 125 | } tx_buffer; 126 | 127 | 128 | /** private data for the \c hd44780 driver */ 129 | typedef struct hd44780_private_data { 130 | /* parallel connection types */ 131 | unsigned int port; /**< parallel port */ 132 | 133 | /* serial connection types */ 134 | int fd; /**< file handle to serial device */ 135 | int serial_type; /**< type of device for hd44780-serial */ 136 | 137 | #ifdef HAVE_LIBUSB 138 | /* libusb-based connection types */ 139 | usb_dev_handle *usbHandle; /**< USB device handle */ 140 | int usbIndex; /**< USB interface index */ 141 | int usbMode; /**< USB write mode (bulk or interrupt)*/ 142 | int usbEpOut; /**< USB Endpoint Out */ 143 | int usbEpIn; /**< USB Endpoint In */ 144 | tx_buffer rx_buf; /**< Input buffer */ 145 | #endif 146 | 147 | #ifdef HAVE_LIBFTDI 148 | /* libftdi-based connection types */ 149 | struct ftdi_context ftdic, ftdic2; 150 | 151 | int ftdi_mode; 152 | int ftdi_line_RS; 153 | int ftdi_line_RW; 154 | int ftdi_line_EN; 155 | int ftdi_line_backlight; 156 | #endif 157 | 158 | #ifdef HAVE_I2C 159 | /* libi2c-based connection types */ 160 | 161 | int i2c_backlight_invert; 162 | int i2c_line_RS; 163 | int i2c_line_RW; 164 | int i2c_line_EN; 165 | int i2c_line_BL; 166 | int i2c_line_D4; 167 | int i2c_line_D5; 168 | int i2c_line_D6; 169 | int i2c_line_D7; 170 | 171 | #endif 172 | 173 | #ifdef WITH_ETHLCD 174 | int sock; /**< socket for TCP devices */ 175 | #endif 176 | #ifdef WITH_RASPBERRYPI 177 | struct rpi_gpio_map *rpi_gpio; /**< GPIO pin mapping for Raspberry Pi */ 178 | #endif 179 | 180 | int charmap; /**< index of currently used charmap */ 181 | 182 | int width, height; /**< size of display (characters) */ 183 | int cellwidth, cellheight; /**< size a one cell (pixels) */ 184 | 185 | unsigned char *framebuf; /**< the framebuffer */ 186 | unsigned char *backingstore; /**< buffer for incremental updates */ 187 | 188 | CGram cc[NUM_CCs]; /**< the custom character cache */ 189 | CGmode ccmode; /**< character mode of the current screen */ 190 | 191 | /* Connection type data */ 192 | int connectiontype; 193 | struct hwDependentFns *hd44780_functions; 194 | 195 | /** \name Screens spanning several display 196 | *@{*/ 197 | /** 198 | * \c spanlist is an array which stores the number of the display a 199 | * line is shown own. (disp=spanList[line]) 200 | */ 201 | int *spanList; 202 | int numLines; /**< total number of lines for screen */ 203 | 204 | /** 205 | * \c dispVOffset is an array that stores for each display its offset 206 | * aka start line within the (virtual) screen. Use this to determine 207 | * the vertical positioning on a given display. 208 | */ 209 | int *dispVOffset; 210 | int numDisplays; /**< total number of displays */ 211 | 212 | /** Array storing the vertical size of each display. */ 213 | int *dispSizes; 214 | /**@}*/ 215 | 216 | /** \name Display features 217 | *@{*/ 218 | char have_keypad; 219 | char have_backlight; 220 | char have_output; 221 | /**@}*/ 222 | 223 | char ext_mode; /**< use extended mode on some weird controllers */ 224 | int line_address; /**< address of the next line in extended mode */ 225 | 226 | int delayMult; /**< Delay multiplier for slow displays */ 227 | char delayBus; /**< Delay if data is sent too fast over LPT port */ 228 | 229 | /** 230 | * lastline controls the use of the last line, if pixel addressable 231 | * (true, default) or underline effect (false). To avoid the 232 | * underline effect, last line is always zeroed for whatever 233 | * redefined character. 234 | */ 235 | char lastline; 236 | 237 | /** \name Keypad 238 | *@{*/ 239 | /** 240 | * keyMapDirect contains an array of strings (ASCII-codes) that 241 | * should be generated when a directly connected key is pressed (not 242 | * in matrix). 243 | */ 244 | char *keyMapDirect[KEYPAD_MAXX]; 245 | 246 | /** 247 | * keyMapMatrix contains an array with arrays of strings 248 | * (ASCII-codes) that should be generated when a key in the matrix is 249 | * pressed. 250 | */ 251 | char *keyMapMatrix[KEYPAD_MAXY][KEYPAD_MAXX]; 252 | 253 | char *pressed_key; /**< The last pressed key */ 254 | int pressed_key_repetitions; /**< Number of repeated key presses */ 255 | struct timeval pressed_key_time;/**< Time the key was pressed first */ 256 | int stuckinputs; /**< Value on the parallel port input if no keys are pressed */ 257 | /**@}*/ 258 | 259 | int backlight_bit; /**< shorthand for the value of the BL bit if it is set */ 260 | 261 | /** \name Forced screen updates 262 | *@{*/ 263 | time_t nextrefresh; /**< Time when the next refresh is due. */ 264 | int refreshdisplay; /**< Seconds after which a complete display update is forced. */ 265 | /**@}*/ 266 | 267 | /** \name Keepalive 268 | *@{*/ 269 | time_t nextkeepalive; /**< Time the next keep-alive is due. */ 270 | int keepalivedisplay; /**< Refresh upper left char every \c keepalivedisplay seconds. */ 271 | /**@}*/ 272 | 273 | int output_state; /**< most recently output to the output port */ 274 | 275 | /** \name Contrast and brightness 276 | *@{*/ 277 | int contrast; /**< Contrast value (range 0 - 1000) */ 278 | int brightness; /**< Brightness when backlight is "on" (range 0 - 1000) */ 279 | int offbrightness; /**< Brightness when backlight is "off" (range 0 - 1000) */ 280 | int backlightstate; /**< Saves the last backlight state (on/off) */ 281 | /**@}*/ 282 | 283 | /** Output buffer to collect command or data bytes */ 284 | tx_buffer tx_buf; 285 | } PrivateData; 286 | 287 | 288 | /** Structure holding pointers to HD44780 specific functions */ 289 | typedef struct hwDependentFns { 290 | /** Wait for some micro seconds. 291 | * \param p pointer to private date structure 292 | * \param usecs micro seconds to wait 293 | */ 294 | void (*uPause) (PrivateData *p, int usecs); 295 | 296 | /** \name Report and debug helper: set by global hd44780 init */ 297 | /**@{*/ 298 | void (*drv_report) (const int level, const char *format,... /* args */ ); 299 | void (*drv_debug) (const int level, const char *format,... /* args */ ); 300 | /**@}*/ 301 | 302 | /** Send a single byte of data to the LCD. 303 | * \param p pointer to private date structure 304 | * \param dispID display to send data to (0 = all displays) 305 | * \param flags data or instruction command (RS_DATA | RS_INSTR) 306 | * \param ch character to display or instruction value 307 | */ 308 | void (*senddata) (PrivateData *p, unsigned char dispID, unsigned char flags, unsigned char ch); 309 | 310 | /** 311 | * Flush data to the display. To be used by sub-drivers that queue from 312 | * senddata internally. 313 | */ 314 | void (*flush) (PrivateData *p); 315 | 316 | /** Switch the backlight on or off 317 | * \param p pointer to private date structure 318 | * \param state to be or not to be on 319 | */ 320 | void (*backlight) (PrivateData *p, unsigned char state); 321 | 322 | /** Set the contrast 323 | * \param p pointer to private date structure 324 | * \param value new value to be set 325 | */ 326 | void (*set_contrast) (PrivateData *p, unsigned char value); 327 | 328 | /** Read the keypad 329 | * \param p pointer to private date structure 330 | * \param Ydata Up to 11 bits that should be put on the Y side 331 | * of the matrix. 332 | * \return Up to 5 bits that are read out on the X side of the matrix. 333 | */ 334 | unsigned char (*readkeypad) (PrivateData *p, unsigned int Ydata); 335 | 336 | /** Scan the keypad and return a scancode. 337 | * \param p pointer to private date structure 338 | * \return Y-value in the high nibble and X-value in the low nibble. 339 | * 340 | * \note A sub-driver should either implement \c readkeypad or 341 | * override \c scankeypad. 342 | */ 343 | unsigned char (*scankeypad) (PrivateData *p); 344 | 345 | /** Output "data" to output latch if there is one. 346 | * \param p pointer to private date structure 347 | * \param data Value to put on the output latch (up to 32 bit) 348 | */ 349 | void (*output) (PrivateData *p, int data); 350 | 351 | /** Close the interface on shutdown */ 352 | void (*close) (PrivateData *p); 353 | } HD44780_functions; 354 | 355 | 356 | /* Prototypes */ 357 | void common_init(PrivateData *p, unsigned char if_bit); 358 | 359 | 360 | /* commands for senddata */ 361 | #define RS_DATA 0x00 362 | #define RS_INSTR 0x01 363 | 364 | /** \name ---------------- The HD44780 Instruction Set -------------------- */ 365 | /**@{*/ 366 | /* 367 | * The instruction set below is for the original HD44780 and compatibel and 368 | * those that support extended function registers (like the KS0073). For 369 | * extended function registers two instruction sets exist but we assume 370 | * "instruction set 2" below. 371 | * 372 | * Note: RE=0 means EXTREG bit has not been set, RE=1 means EXTREG has been 373 | * set. The term 'RE' is used in the datasheets so I use it here as well. 374 | */ 375 | 376 | /** Clear display */ 377 | #define CLEAR 0x01 378 | 379 | /** Return home */ 380 | #define HOMECURSOR 0x02 381 | 382 | /** Entry mode set */ 383 | #define ENTRYMODE 0x04 384 | #define E_MOVERIGHT 0x02 385 | #define E_MOVELEFT 0x00 386 | #define EDGESCROLL 0x01 387 | #define NOSCROLL 0x00 388 | 389 | /** Display on/off control (RE=0) */ 390 | #define ONOFFCTRL 0x08 391 | #define DISPON 0x04 392 | #define DISPOFF 0x00 393 | #define CURSORON 0x02 394 | #define CURSOROFF 0x00 395 | #define CURSORBLINK 0x01 396 | #define CURSORNOBLINK 0x00 397 | 398 | /** Extended function set (RE=1) */ 399 | #define EXTMODESET 0x08 400 | #define FONT6WIDE 0x04 401 | #define FONT5WIDE 0x00 402 | #define INVCURSOR 0x02 403 | #define FOURLINE 0x01 /**< If not set, ONELINE or TWOLINE is used */ 404 | 405 | /** Cursor or display shift (RE=0) */ 406 | #define CURSORSHIFT 0x10 407 | #define SCROLLDISP 0x08 408 | #define MOVECURSOR 0x00 409 | #define MOVERIGHT 0x04 410 | #define MOVELEFT 0x00 411 | 412 | /** Shift or scroll enable (RE=1) */ 413 | #define HSCROLLEN 0x10 414 | 415 | /** Function set (RE=0) */ 416 | #define FUNCSET 0x20 417 | #define IF_8BIT 0x10 418 | #define IF_4BIT 0x00 419 | #define TWOLINE 0x08 420 | #define ONELINE 0x00 421 | #define LARGECHAR 0x04 /**< 5x11 characters */ 422 | #define SMALLCHAR 0x00 /**< 5x8 characters */ 423 | #define EXTREG 0x04 /**< Select ext. registers (Yes, the same bits) */ 424 | #define SEGBLINK 0x02 /**< CGRAM/SEGRAM blink, only if RE=1 */ 425 | 426 | /** Set CGRAM address (RE=0) */ 427 | #define SETCHAR 0x40 428 | 429 | /** Set SEGRAM address (RE=1) */ 430 | #define SETSEG 0x40 431 | 432 | /** Set DDRAM address (RE=0) */ 433 | #define POSITION 0x80 434 | 435 | /** Set scroll quantity (RE=1) */ 436 | #define HSCROLLAMOUNT 0x80 437 | 438 | /** Default Lineaddress in 4 line mode (RE=1) */ 439 | #define LADDR 0x20 440 | 441 | /**@}*/ 442 | #endif 443 | --------------------------------------------------------------------------------