Text LCD

29 Aug 2011

Hi guys,

I want to ask if you know if the Text LCD library includes in the code the necessary delays after, for example a clear LCD instruction? Because sometimes, if I don´t insert some wait instructions in my code after a LCD instruction, the LCD doesn´t respond properly.

Also, I want to know if someone has experience of having any trouble using this library, or every thing worked fine.

Thanks in advance,

Emanuel

29 Aug 2011

As far as I can see, the read/write line in the TextLCD library is supposed to be connected to GND there is no way of checking the busy bit of the LCD and thus timing will depend on the particular LCD you use.

31 Aug 2011

Thank you for your answer Gert. I really apreciate it.

31 Aug 2011

Ciao Emanuel,

I have tweaked this library to use on my own project.It looks as if the problem is in the E signal timing is not right, certainly in derivatives of TextLCD. The E signal is left HIGH after a transfer - but it should be low.

Correct sequence should be:

1. Write the correct data on D7:D4 with E LOW, and RS in the correct condtion (command or display data is selected by it) 2. Wait 1us. 3. Write the data/RS again, with E HIGH. 4. Wait 1us. 5. Write the same data/RS yet again, with E again low 6. wait 1us

In addition, The clear screen command requires a longer wait - I use 10ms to cover many different types, including the Winstar OLED 20 x 4.

If any of the 6 steps above are omitted, the driver is in violation of the timing diagram of the Sunplus 780, the Winstar WS0010, or any of the other clones of the HD44780 that are actually inside today's module production. The Hitachi original is no longer in production.

The reason for the complexity is that this old Motorola bus timing latches the data at the fall of E, but requires data to be present slightly before and after. tHe 1us is larger than needed, but this will ensure reliability across a wide range of driver chips, some of which may not comply very well with the timing specs.

Sorry, my library is a bit roughly constructed at the moment, and customised to the WinStar OLED 20x4, and I2C front end.

05 Sep 2011

Thank you very much Rod.

I am going to try what you said, and I´ll tell you the results.

Thanks and regards

05 Sep 2011

I have used these timings for many HD44780 like Text LCDs:

/media/uploads/gertk/_scaled_lcd_timing.png

/media/uploads/gertk/lcd_timing.png

/media/uploads/gertk/_scaled_lcd_timing2.png

/media/uploads/gertk/lcd_timing2.png

You can see here also that the R/W and RS lines need to be set a minimum of 140 nsec before asserting E high (Register Select set-up Time trsu).

E goes low after 450 nsec to latch the data and after 'Address Hold Time tAH' the R/W, RS and data lines may be released.

18 Sep 2011

Thanks Gert. I am going to check the time diagrams of the LCD I am using.

Thank you very much.

18 Sep 2011

Hi guys,

I have one more question to ask.

I am reading TextLCD library, and I don`t know what the next parameter definition means:

/ Create a TextLCD interface

  • @param rs Instruction/data control line
  • @param e Enable line (clock)
  • @param d4-d7 Data lines for using as a 4-bit interface
  • @param type Sets the panel size/addressing mode (default = LCD16x2)
  • /

TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2);

What is the meaning of PinName?

Thanks and best regards

27 Sep 2011

PinName is just the identifier used by the mbed library. It's the same as using "int" or "float":

myFunction(int a, float b)

27 Sep 2011

Thank you Robert.

I understand it right now.

You need to log in to post a reply