I'm using the CMD_HOME to return to the DDRAM adress of the beginning of the screen. I don't know how to read the DDRAM adress from the LCD to send it back to it after CGRAM writing (we needed to do that because the controller only has one memory pointer).

Jonathani have the same display (not working yet), can you show the wiring diagram you used, and the modifications you made to the sample code. also, did you ground RW ? ( as indicated in reply #10 of http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1160586800/0#0)thx!!detailed version http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1173804342---------------------------------------------------

Quote

Hi everyone,

I've made a modified version of the LCD4Bit for allowing it to work with my 20x4 displays, it should continue to work with 20x1, 20x2 and others display (I hope so). Hope it'll help some of you!

Bjonnh

I used exactly the wiring scheme for LCD4bit classic version.The modifications were only on the initialisation code of the library (to allow 4 lines selection), and in cursor position.

---How to use it

The library is intended to be a 4-bit replacement for the original LCD tutorial code and is compatible with very little change. Here's what you must do after the setup described in the original tutorial:

* In your circuit (1): You must tie the LCD's R/W pin to ground. (This frees another arduino pin for you). See this forum post for more troubleshooting. * In your circuit (2): remove the 4 lower bits of the data bus between the arduino and the LCD. We only use DB4~7. * In your code: The constructor now requires to know if your display is 1 or 2 lines. e.g. LCD4Bit lcd = LCD4Bit(1);

This display has a second HD44780 for the third and fourth line with its own Enable Input.So I wired the second Enable Input to pin 3 on the arduino and edited mainly LCD4Bit::cursorTo(int line_num, int x) a little to work with this display.

//non-core stuff --------------------------------------//move the cursor to the given absolute position. line numbers start at 1.//if this is not a 2-line LCD4Bit instance, will always position on first line.////legba7: second controller, with its own Enable input, for line 3 and 4void LCD4Bit::cursorTo(int line_num, int x){

// --------- PINS -------------------------------------//is the RW pin of the LCD under our control? If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.//this stops us sending signals to the RW pin if it isn't being used.int USING_RW = false;

//RS, RW and Enable can be set to whatever you likeint RS = 12;int RW = 11;//legba7: two HD44780; per HD44780 one Enable Inputint Enable1 = 2;int Enable2 = 3;int Enable = Enable1;//DB should be an unseparated group of pins - because of lazy coding in pushNibble()int DB[] = {7, 8, 9, 10}; //wire these to DB4~7 on LCD.

// --------- PINS -------------------------------------//is the RW pin of the LCD under our control? If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.//this stops us sending signals to the RW pin if it isn't being used.int USING_RW = false;

//RS, RW and Enable can be set to whatever you likeint RS = 12;int RW = 11;//legba7: two HD44780; per HD44780 one Enable Inputint Enable1 = 2;int Enable2 = 3;int Enable = Enable1;//DB should be an unseparated group of pins - because of lazy coding in pushNibble()int DB[] = {7, 8, 9, 10}; //wire these to DB4~7 on LCD.

You will need to search the cpp file to modify any code that is aware of the total number of lines. In the 4bit library I think there is a global variable called g_num_lines, search on that and modify the code as necessary to respect values from 1 to 4 as valid.