====== HD44780 ====== This driver supports all display modules based on the Hitachi HD44780 chip. These displays are made by different manufactures, and come in various sizes. The HD44780 is probably the most common display driver. The displays are connected to the parallel board (see //Wiring// below), and are quite timing-critical. There's no way to delay a usermode program under Linux for e.g. 40 usec, so we have to do busy-waiting. This has been done in a delay loop, which had to be calibrated. Since 0.9.8 there are two new delay loops, one based on the processor's TSC (Time Stamp Counter), one based on gettimeofday(). LCD4Linux decides automatically which one to use (it prefers the TSC method, but falls back to gettimeofday() if neither the TSC flag nor the MHz value is set in /proc/cpuinfo). Calibration is no longer necessary! The driver knows of two ways of controlling the parallel port: The (old, ugly and unportable) raw programming of ports, and the new, cool, great ppdev() style. You decide which one to use by specifying either a hexadecimal value or a device file with the 'Port' entry in the config file. Note that the old port programming only works with standard ports (0x3f8, 2f8,...), but not with PCI parallel port cards. Also, some //secured// linux systems (//[[http://leaf.sourceforge.net|LEAF]]// kernels with the //[[http://www.grsecurity.net|grsecurity]]// patches being one) do not allow a userspace program to do raw I/O (not even if running as root), so you **have to** use ppdev there anyway. ppdev requires kernel 2.4 or newer, and the //ppdev// kernel module loaded. The configure script detects if you have the required include files, and deactivates ppdev if they are not there. **You should use ppdev whenever possible!** Raw port access may be dropped someday. Note that you have to use parport devices (usually ///dev/parports/*// or ///dev/parport*// with major number 99), the printer devices (///dev/printers/*// or ///dev/lp*// with major number 6) do **NOT** work! If you are using devfs or udev, these devices may become visible as soon as you load the //ppdev// kernel module. The driver fully supports the text, bar and icon widgets. ---- ===== Display Section ===== Display { Driver 'HD44780' Model Bus Port Device Controllers <1|2|3|4> Bits <4|8> UseBusy <0|1> GPOs Backlight <0|1> Brightness Size Size1 Size2 Size3 Size4 asc255bug <0|1> Icons Wire { RW RS ENABLE ENABLE2 ENABLE3 ENABLE4 BACKLIGHT GPO POWER } Timing { fuzz CY PW AS AH INIT1 INIT2 EXEC WRCG CLEAR HOME ONOFF GPO_ST GPO_PW POWER } } ---- ===== Parameters: ===== |**Driver**|'HD44780'| |**Model**|see below| |**Bus**|'parport' (default) or 'i2c'| |**Port**|either the hexadecimal address of the parallel port ("0x378") or a ppdev device ("/dev/parports/0")| |**Device**|The I2C device| |**Controllers**|set to 2 if you have a dual-controller display, or number of real displays; default: 1| |**Bits**|4 (4-bit-mode) or 8 (8-bit-mode, default)| |**!UseBusy**|0 (don't use Busy-Flag checking, default) or 1 (use Busy-Flag checking)| |**GPOs**|number of general purpose outputs, use 0 (zero, which is the default) to deactivate this feature| |**Backlight**|backlight on/off| |**Brightness**|backlight level (Noritake displays only)| |**Size**|x e.g. "16x2"; for multiple displays the overall size| |**Size2, Size3, Size4**|x for second, third and forth display| |**asc255bug**|set to 1 if you don't get solid blocks in bars, but an inverted P (the //Portishead syndrome// :-) or a { (curly brace) on a KS0073| |**Icons**|Number of user-defined chars reserved for Icons (default: 0)| |**Wire.***|see below| |**Timing.***|see below| ---- ===== Models: ===== The driver supports different models of the HD44780, which can be selected with the 'Model' parameter: |**generic**| standard HD44780 display (default)| |**Noritake**|same as 'generic', but with software-controlled backlight| |**Soekris**|very special interface which supports busy-flag checking in 4-bit-mode| |**HD66712**|a controller similar to the HD44780, but with slightly different RAM-Layout (use this model for a KS0073, too!)| |**LCM-162**|a small interface between the parallel port and a HD44780 display which can be found in the Nexcom Blade Servers. It is hard-wired (no 'Wire'-section necessary, uses 8-bit-mode with busy-flag checking, and has a little keypad with four keys.| ---- ===== Examples: ===== ==== generic HD44780 display (LCD4Linux wiring) ==== Display HD44780-generic { Driver 'HD44780' Model 'generic' Port '/dev/parports/0' Size '20x4' Wire { RW 'GND' RS 'AUTOFD' ENABLE 'STROBE' ENABLE2 'GND' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } } ==== generic HD44780 display (!WinAmp wiring) ==== Display HD44780-winamp { Driver 'HD44780' Model 'generic' UseBusy 1 Port '/dev/parports/0' Size '20x4' Wire { RW 'AUTOFD' RS 'INIT' ENABLE 'STROBE' ENABLE2 'GND' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } } ==== HD44780 display from kernelconcepts.de ==== Display HD44780-kernelconcepts { Driver 'HD44780' Model 'HD66712' UseBusy 1 Port '/dev/parports/0' Size '20x4' Wire { RW 'AUTOFD' RS 'INIT' ENABLE 'STROBE' ENABLE2 'GND' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } } ==== 16x4 and 20x2 HD44780 on one bus ==== Display HD44780-dual { Driver 'HD44780' Model 'generic' Port '/dev/parports/0' Controllers 2 Size '20x6' Size1 '16x4' Size2 '20x2' Wire { RW 'GND' RS 'AUTOFD' ENABLE 'STROBE' ENABLE2 'SLCTIN' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } } ---- ===== Plugins: ===== The driver provides the following functions: |**LCD::Backlight(n)**|turns the backlight on (1) or off (0)| |**LCD::Brightness(n)**|sets the backlight level to n (0..3) (Noritake displays only!)| ---- ===== Wiring: ===== There are two basic wiring modes for HD44780-Displays: a 4 bit and a 8 bit mode. Since 0.9.11 lcd4linux supports both modes! There are large (40x4) displays which internally consist of two HD44780 chips, with two seperate "Enable" lines. Since 0.9.11 lcd4linux supports these displays, too! You can connect up to four displays on one bus (example schematic below), connecting all "RS" lines and seperate all "Enable" lines to one parallel port. The size of the displays is given with "Size1", "Size2", "Size3" and "Size4" and are automatically evaluated to form "Size", so you can omit it, too. It is assumed that all displays (controllers) are one below the other to form "one big display", with being the row-size of the biggest display. Edit the layout to correspond with the "Size" parameter and you can control all displays at once. Normally a HD44780-based display has 14 or 16 pins, where pins 15 and 16 are used for backlight. Power (+5V) must be supplied via pins 1(GND) and 2(+5V), be careful not to change polarity, you will destroy your display! Pin 3 is used to control the contrast, you can either hardwire it to GND (pin 1) or place a potentiometer (10k-20k) between pins 1 and 2, and connect pin 3 to the slider. There are a lot of different wirings out there (lcdproc, WinAmp, ...), so I decided to implement a //parallel port abstraction layer// which makes the wiring completely configurable! (this is what the //Wire.xy// entries in the configuration are for). This feature is available in V0.9.9, previous versions still use the default wiring. If you don't use the this default wiring scheme, you have to change these lines accordingly. The wiring configuration uses abstract signal names (e.g. //STROBE//) instead of pin numbers on the parallel port. So here's a translation table: |**Pin**|**Name**|**I/O**| |1|STROBE|Out| |2|DB0|I/O| |3|DB1|I/O| |4|DB2|I/O| |5|DB3|I/O| |6|DB4|I/O| |7|DB5|I/O| |8|DB6|I/O| |9|DB7|I/O| |10|ACK|In| |11|BUSY|In| |12|PAPEROUT|In| |13|SELECT|In| |14|AUTOFD|Out| |15|ERROR|In| |16|INIT|Out| |17|SLCTIN|Out| |18-25|GND|n/a| A HD44780-Display usually has 16 Pins (if you find only 14, there's no backlight, so pin 15 and 16 are missing) |**Pin**|**Name**|**Comment**| |1|GND|ground| |2|VCC|supply voltage +5V| |3|LCD_DRIVE|contrast voltage (0 .. +5V)| |4|RS|Register Select (low=instruction, high=data)| |5|R/W|Read / not Write (high=read, low=write)| |6|ENABLE|starts data read/write| |7|DB0|Data Bit 0| |8|DB1|Data Bit 1| |9|DB2|Data Bit 2| |10|DB3|Data Bit 3| |11|DB4|Data Bit 4| |12|DB5|Data Bit 5| |13|DB6|Data Bit 6| |14|DB7|Data Bit 7| |15|BACKLIGHT|backlight supply voltage| |16|BL GND|backlight ground| Warning: I've seen displays with the pins in the following order: 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 !!! Now for the wiring details in 8-bit mode: * The data lines (DB0..DB7 on the display, DB0..DB7 on the parallel port) are connected directly. * The "RS" signal has to be connected to one of the control signals (STROBE, SLCTIN, AUTOFD or INIT). LCD4Linux's default is AUTOFD. * The "RW" signal from the display may be harwired to GND, we do not read anything from the display. If you want to use busy-flag checking, you have to connect it to a control signal, which must be specified with the Wire.RW line. LCD4Linux's default is GND * The "Enable" signal has to be connected to one of the control signals. LCD4Linux's default is STROBE. * The second, third and fourth "Enable" (for displays with two controllers or multiple displays) signal has to be connected to one of the control signals. LCD4Linux's default is GND (i.e. not connected). and with 4-bit mode: * The data lines DB4..DB7 on the display are connected to DB0..DB3 on the parallel port. The remaining DB0..DB3 on the display are not used. * The "RS" signal has to be connected to one of the other data lines (DB4..7). LCD4Linux's default is DB4. * The "RW" signal from the display may be harwired to GND, we do not read anything from the display. If you want to use busy-flag checking, you have to connect it to a control signal, which must be specified with the Wire.RW line. LCD4Linux's default is GND. * The "Enable" signal has to be connected to one of the other data lines. LCD4Linux's default is DB6. * The second, third and fourth "Enable" (for displays with two controllers or multiple displays) signal has to be connected to one of the control signals. LCD4Linux's default is GND (i.e. not connected). ==== Wiring Examples: ==== If you use the WinAmp-style wiring, connect the following pins: Display Pin 4 (RS) => Parallelport Pin 16 (Init) \\\ Display Pin 5 (R/W) => Parallelport Pin 14 (AutoFD) \\\ Display Pin 6 (Enable) => Parallelport Pin 1 (Strobe) \\\ The wiring entries in lcd4linux.conf sould read: Wire { RW 'AUTOFD' RS 'INIT' ENABLE 'STROBE' ENABLE2 'GND' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } Other wiring examples: lcd4linux default 8-bit wiring: Wire { RW 'GND' RS 'AUTOFD' ENABLE 'STROBE' ENABLE2 'SLCTIN' BACKLIGHT 'GND' GPO 'INIT' POWER 'GND' } lcd4linux default 4-bit wiring: Wire { RS 'DB4' RW 'DB5' ENABLE 'DB6' ENABLE2 'DB7' BACKLIGHT 'GND' GPO 'GND' POWER 'GND' } ---- ===== Timing: ===== As I said above, HD44780 are quite timing-critial. First, there is the low-level timing on the parallel port, second is the execution time needed for various commands (especially if you're //not// using busy-flag checking). In the past, we tried to use worst-case values, as the timings differ from datasheet to datasheet. But this did not always work, some displays really need smaller values... So I decided to make the timings configurable. That's what the //Timing// section in the lcd4linux.conf is for. Note that under normal circumstances you won't need such a section, lcd4linux uses default values which should work with most displays. You should consult the datasheet of your display before messing around with these values! To make it easier to play with the timing values, I invented a //fuzz// factor, which modifies all other timing values. This factor is interpreted as a percentage, with a default of 100% (meaning no modification). If you specify a fuzz factor of 150, this leads to all timings being multiplied by 1.5 (so the default 1000 ns //Enable Cycle Time// will be 1500 ns). ==== Low-level timings: ==== |**Name**|**Description**|**Default**|**Unit**| |CY|Enably cycle time|1000|ns| |PW|Enably pulse width|450|ns| |AS|Address setup time|140|ns| |AH|Address hold time|20|ns| ==== HD44780 execution timings: ==== |**Name**|**Description**|**Default**|**Unit**| |INIT1|First init sequence|4100|us| |INIT2|Second init sequence|100|us| |EXEC|normal execution time|80|us| |WRCG|CG RAM Write|120|us| |CLEAR|Clear Display|2250|us| |HOME|Cursor Home|2250|us| |ONOFF|Display On/Off Control|2250|us| ==== GPO timings: ==== If you're using a 74HCT573 or similar as a latch to control one or more GPO's, you may specify the timing, too: |**Name**|**Description**|**Default**|**Unit**| |GPO_ST|74HCT573 set-up time|20|ns| |GPO_PW|74HCT573 enable pulse width|230|ns| ==== power-from-parport timings: ==== If you're fetching supply voltage from an unused pin from the parallel port (see below), you can control how long LCD4linux delays after rising this power pin: |**Name**|**Description**|**Default**|**Unit**| |POWER|delay between rising the power supply signal and further initialisation|500|ms| ==== Sample Timing Section: ==== Timing { CY 1000 PW 450 AS 140 AH 20 INIT1 4100 INIT2 100 EXEC 80 WRCG 120 CLEAR 2250 HOME 2250 ONOFF 2250 GPO_ST 20 GPO_PW 230 POWER 500 } ---- ===== Backlight: ===== If your Display (or your interface) provides a way to control the backlight by software, LCD4Linux supports this, too. You need an additional control signal from the parallel port. You have to specify this signal with the //Wire.Backlight// entry in the config file (the default is //GND//, i.e. not connected). The initial backlight state my be specified with the //Backlight// parameter in the //Display// section. If you have a Noritake Display, backlight brightness can be controlled, too. The initial backlight level my be specified with the //Brightness// parameter in the //Display// section. ---- ===== GPO's: ===== You can connect up to 8 digital output lines to the parallel port with a simple additional circuit (e.g. to drive a LED). These lines can be controlled by lcd4linux, and need an additional control signal from the parallel port. You have to specify this signal with the //Wire.GPO// entry in the config file (the default is //GND//, i.e. not connected). See the [[:widget_gpo|GPO widget]] section for how to use these GPO's. ---- ===== power-supply from parport (//experimental//) ===== It should be possible to get the power supply for your display from an unused signal from the parallel port. Please not that we're talking about //display power supply//, not the backlight! If you want to try so, you have to specify this signal with the //Wire.Power// entry in the config file (the default is //GND//, i.e. no power from parport). To allow the display to settle down, there's a delay between rising this power-supply signal and the HD44780 initialisation sequence. You can modify this default delay of 500 msec with the //Timing.POWER// entry in the config file. Note that this will probably work with a 5V parallel port only! (and most modern PC's deliver 3.3V) ---- ===== Schematic: ===== I'm using a 'general purpose' interface board to quickly test various displays. It consists of a stabilized voltage regulator, a connector to the parallel port, the circuit to drive 8 LED's, and two potentiometers to control backlight and contrast. Here's the schematic and board (designed with eagle): {{:schematics.png}} {{:board.png}} And here an example, two displays on one bus (16x4 and 20x2): '''ATTENTION! Wrongly cabled on Picture! Pin 6 of Display 2 have to be connected to Pin 17 (SelectIn) of Paralellport! {{:multiple.png}} -----