GenBoard/BuildProcedures/LCDconnect (2005-07-20 22:49:32)

GenBoard/VerThree : electrical connecion of standard HD44780 LCD (like LCD 204B)

Data sheet for the 20x4 LCD display sold in the WebShop [Displaytech LCD 204B]

recommended colorJP_LCDLCDfunctionDB9oldpinoutDB9proposedpinoutDB25pinout Note
brown21 Gnd6 55 pin2 is not in the leftmost column on the v3 LCD header: Leftmost column is pins -1,0 that are elsewhere in the schematic. Also connect the cable shield to GND signal, but only at the DB9 end (not at the v3.2 board end)
red102 Vcc 1 11pin10 is in the right-upper pin on v3 LCD header
yellow9 - -8V - -14 optional: negative from MAX 232 thru R112. Some LCD like slightly negative potential on contrast pin (LCD pin3) for which this can be used. Try the variable resistor method below. If there is no viewability with 0 or positive contrast votlage, or best result is with variable resistor fully set to GND (not a bit of +5V applied), you can try to devise a nagative contrast voltage, starting from -8V instead of +5V for slightly better result. See LCD negative contrast section below
-- 3 Contrast - --Solder a 2k2 .. 4k7 .. 10k variable resistor between GND and +5V, with middle terminal to LCD pin3. Set variable resistor for best contrast (it will be near GND). After finding best contrast you can replace variable resistor with matching resistor values. Most LCD like a 470 Ohm .. 1k to GND and 5k6 .. inf towards +5V
white1 4 RS 3 9 18 data or cmd
orange7 5 R/W 7 6 15 data dir. If busypoll is disabled in configuration (not recommended!) LCD pin7 can be connected to constant GND (LCD pin1) on the LCD side (which means data direction is always GenBoard => LCD), freeing a signal: DSUB pin7. This is useful when an extra signal is required for the LCD with negative contrast. Note that this breaks the DSUB9 pinout compatibility, so take care if using both types of connector pinouts. DSUB15 or DSUB25 is recommended for LCD with negative contrast voltage, so R/W pin is connected and busypoll can be enabled (recommended)
purple8 6 Enable 42 2 latch control
green611Databit4 5 3 3  
grey512 Databit59 716  
darkblue413 Databit6844  
black314 Databit72 8 17 
 -15 Backlight+- - - You can connect it to VCC with a 22..100 Ohm resistor. Note that voltage drop of backlight LEDs (2 in series?) is sometimes over 4V
 -16 Backlight-- - - This can be connected to GND via a manual switch. Alternatively it could be switched with a p259 pin, or with a small NPN near the LCD: the NPN base can be controlled through a 1k..2k2 resistor by a free pin of the s259 (allowing software-PWM for backlight dim)

LCD that requires a negative (appr. -3V) contrast voltage.

When bought from WebShop, the crew will warn of this. LCD's that require negative contrast voltage usually have superior viewing contrast. However, such an LCD will not be viewable at all with -2V .. 0V on contrast.

LCD with -3V contrast

The way it works - for the curious:

The setup for the contrast voltage is effectively a voltage divider from 2..3 resistors:

The resulting voltage is the weighted average of the voltage "pulls". The weights are the reciprocal of resistor values (1/R), see example below.

Resistor divider example:

4k7 internal pullup inside the LCD towards +5V and onboard R112=3k pull towards -8V the weights are 1/4.7 and 1/3:\nÿ1ÿ

Note that any resistor that is not there (eg. unsoldered) is infinite resistance, so the weight is 1/inf = 0 (no need to calculate with those)


When LCD needs negative contrast, use a DSUB15 or DSUB25, since the DSUB9 does not have enough pins for both negative contrast and busypoll (R/W) signal

The non-recommended way to make negative contrast work with DSUB9 (unfortunately busypoll disabled => not optimal)


Connecting keyboard through DB25

I propose this pinout that I've used on four boards now, along with the LCD pinout described above:

See also [[Manual: Detailed.Central.Keyboard.Install]]

JP_PS1DB25pinoutMini DIN6Function
1224Vcc
2233Gnd
3241Data
4255Clock

See also: