Connecting an LCD display to the Sweex/Edimax router

Thanks to Grzegorz (Watt) who sent me this picture
of his system using the dl4huf lcd_out.c (2x16)

in file: /etc/init.d/S99heart_led
he added these lines:

/root/lcd_out -i
/root/lcd_out ADM5120P
/root/lcd_out -2
/root/lcd_out "System ready"

"dl4huf" has published lcd_out.c here (my backup is here )

This allows you to connect a standard 2 line by 16 character display to six of the Sweex status led lines.

The display is based on the HD44780 chip and is cloned by many manufacturers.

I wanted to use a 4 line by 20 character display and managed to see how to modify the code
lcd_out_4x20.c is here and the compiled version lcd_out_4x20 is here
(updated 17 jan 07 - the -i command failed on my LCD and dl4huf found a bug - all OK now)

I copied lcd_out_4x20 to usr/bin on the memory stick using wget

initiallise the display
midge# lcd_out_4x20 -i

send the curser to the start of line 3
midge# lcd_out_4x20 -3

display the word "three" on line three
midge# lcd_out_4x20 three

Connections

LCD pin Function Data sheet LED number Circuit board LED number
1 Vss earth    
2 Vdd +5 volts    
3 5Kohm contrast potentiometer centre connection (ends go to 0 and +5 volts)    
4 RS 6 11
5 R/W - connect to earth    
6 E - enable 12 12
7 0 - data line NC  
8 1 - data line NC  
9 2 - data line NC  
10 3 - data line NC  
11 4 - data line 8 4
12 5 - data line 9 6
13 6 - data line 10 8
14 7 - data line 11 10
15 LED +5 volts (use an external 5 volt supply)    
16 LED Earth (the Sweex wall power supply is only 500mA)    

NC = no connection
(led connection:-
there are small + and - marks on the router board - partly covered by the small leds.
Connect to the CPU line which is marked "-" on the led - no need to remove the leds)

If you send a long string to the 4 line display the characters fill the lines in the order 1, 3, 2, 4
I learned how to write a short script to make the text flow 1, 2, 3, 4
I also built a test web page to drive the LCD display from a browser.
The notes are here