[TUT] HD44780 (Character LCD) timing diagrams

Last post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Character LCDs based on the industry standard HD44780, or some more or less compatible clone, are among the most recurring topics here at AVRfreaks. The HD44780 data sheet holds all information needed, but is is not perfectly organized for a newcomer to the subject, and it might be daunting to plow through the 100 or so pages.

In my world the basic procedure for reading or writing a byte (or nibble in the 4-bit interface) is best illustrated by the timing diagrams. Still they are clobbered with some detail that has little consequence when using AVRs - specifically the rise/fall time requirements.

Redrawing them, removing rise/fall times, and putting the actual numbers into the diagram, yields two remarkably clear diagrams.

Since my LCD tutorial never got written (or at least not yet) I've decided to create this mini-tutorial with my simplified, but sufficient, timing diagrams.

In the diagram for a read operation, the timing in red is a promise on what the 44780 will perform. All other timings, black, in both diagrams, are minimum timing requirements on how your AVR app must perform.

Enjoy!

[I had some problem going from my original SVG files to something that AVRfreaks accepted as an attachement. I ended up PNGs of rather low quality. Please do not re-distribute to other sites, but point here instead as I will update when I find a better conversion path and/or target.]

Attachment(s): 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In another thread

Jepael wrote:

Johan, great pictures and the timings are like in my HD44780U datasheet, except the data bus stable during read is 160ns in my datasheet instead of 120ns. Is that a typo or do you have a different datasheet?

Thank you! I hope you do agree that these diagrams are quite good illustrations not only of the specific timings, but the sequence as such, yes?

Double-checking, my sheet actually says 160 ns so that is a definitive typo. Thank you for the observation and heads-up.

Dear diagram readers! Please note that the 120 ns timing (in red) should read max 160 ns! I will correct this in the next upload of the diagrams, when I have a better wy of converting my (SVG) InkScape drawings to something that AVRFreaks accepts. In the meantime - beware!

(If you find any other errors or "unclearnesses" please post them here.)

[Edit: Corrected the mistyped correct value '150 ns' to the hopefully correct correct value '160 ns'.. :roll:]

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Johan:
If and when you get around to writing your LCD tutorial don't forget to emphasize at least two of the topics that have arisen here lately.

(1) Even though the 'write timing diagram' shows the data lines being set up after 'E' has gone high it is permissible to do things the way many of us do, set up the data lines first and then pulse 'E'. Of course one still has to meet all of the timing specifications.

(2) When reading data from the LCD module (typically the busy flag) many of us have been pulsing 'E' and then reading the data whereas we should be reading the data while 'E' is high. Somehow we have been getting away with this even though the data might only be valid for as little as 5 nS after E goes low. I can understand it working now with our relatively fast microcontrollers but I did this 20 years ago with a much slower 8085 and it seemed to work OK then as well.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Re (1), you're quite right. If one looks at the diagram and the constraints therein, and realizing that a high-and-low-with-grey-in-between means "don't care", then there is nothing prohibiting that one sets up the data lines before everything else. The only things the timing diagram actually requires is that the data lines have been valid and stable for at least 80 ns before E falls, and that they are stable for at least another 10 ns after that. (I know you know Don - I'm only fleshing out on your very wise remark.)

Simliarly, one can set the RS and R/W signals whenever, as long as they are valid and stable for at least 40 ns before E rises, and for at least 10 ns after E falls. E.g. if you have ode that only ever will write to the 44780 (never read from it) but your hardware actually has R/W attached to a pin on your AVR then you can set R at the very start of your program, once and then be done with it.

I.e. for signals being the same as the last time around, you do not need to wiggle them at all. The only thing that must always be wiggled for communicating with the 44780 is the E signal.

Re your (2) it might be a combination of that you got lucky with what code you wrote and/or was generated, and that the module actually held the data valid and stable for more than 5 ms. (And re this last bit, I see that the 5 ns timing should probably also be marked in red colour since this is a specification on how the 44780 will perform, not what it requires. Maybe there should be a "max" also? I'll dig in the sheet tonight or tomorrow..)

I appreciate the comments so far, and will happily take new ones!

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

many thanks for posting this Johan.

Cheers,

Joey

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I finally updated the diagrams and corrected timings. Also, both timings on DB0..7 when reading from the 44780 are now in red, indicating that they are a specification on how the 44780 will perform. All timings in black are specifications on how your software must perform, and are minimum timings.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Compared to Johan's example (Enable cycle time = 500ns): I have some HD44780 LCD's that have Enable cycle time of 1000ns. Also the tDDR (max 160ns in Johan's example) will then be 320ns)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gdhospers wrote:
Compared to Johan's example (Enable cycle time = 500ns): I have some HD44780 LCD's that have Enable cycle time of 1000ns. Also the tDDR (max 160ns in Johan's example) will then be 320ns)
I have some of those as well. Individual chips (as opposed to epoxy blobs) on Optrex boards. The Optrex data that I have for them is dated 1990 as opposed to the 'current' Hitachi data sheet that is dated 1999.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The Optrex data that I have for them is dated 1990

22 years... Anyone have any idea of how old the 44780 actually is?

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Anyone have any idea of how old the 44780 actually is?

I went to the obvious place that might know. Sadly it didn't but while there I couldn't help noticing:

http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller#Font

Would someone brave enough to edit Wikipdedia consider adding an AVR link to the MSP430/PIC list there to some suitable code?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Quote:

The Optrex data that I have for them is dated 1990

22 years... Anyone have any idea of how old the 44780 actually is?

I expect as long as we keep using it, they'll keep making it.

Torby

 

Don't grow up! It's a trap!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At least 1984.