Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
JohanEkdahl
PostPosted: Jul 26, 2011 - 12:34 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 22204
Location: Lund, Sweden

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.]


Last edited by JohanEkdahl on Feb 01, 2012 - 02:01 PM; edited 1 time in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
JohanEkdahl
PostPosted: Jul 26, 2011 - 03:23 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 22204
Location: Lund, Sweden

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'.. Rolling Eyes]


Last edited by JohanEkdahl on Jul 26, 2011 - 08:53 PM; edited 1 time in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
floresta1212
PostPosted: Jul 26, 2011 - 06:01 PM
Resident


Joined: Mar 29, 2006
Posts: 668
Location: Western New York, USA

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
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Jul 26, 2011 - 06:45 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 22204
Location: Lund, Sweden

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!
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
joeyAVR
PostPosted: Aug 01, 2011 - 12:56 PM
Hangaround


Joined: Aug 06, 2008
Posts: 365
Location: Rockall

many thanks for posting this Johan.

_________________
Cheers,

Joey
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Feb 01, 2012 - 02:07 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 22204
Location: Lund, Sweden

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.


Last edited by JohanEkdahl on Aug 19, 2013 - 08:33 AM; edited 1 time in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
gdhospers
PostPosted: Feb 03, 2012 - 01:36 PM
Hangaround


Joined: Oct 04, 2008
Posts: 439
Location: Tilburg, Netherlands

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)
 
 View user's profile Send private message  
Reply with quote Back to top
floresta1212
PostPosted: Feb 03, 2012 - 02:39 PM
Resident


Joined: Mar 29, 2006
Posts: 668
Location: Western New York, USA

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
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Feb 03, 2012 - 03:16 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 22204
Location: Lund, Sweden

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?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: Feb 03, 2012 - 03:27 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71717
Location: (using avr-gcc in) Finchingfield, Essex, England

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_HD ... oller#Font

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

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Torby
PostPosted: May 02, 2012 - 03:32 PM
Raving lunatic


Joined: Nov 11, 2003
Posts: 6189
Location: Tulsa OK USA

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

Cartesian coordinates are SO 17th century.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
jayjay1974
PostPosted: May 27, 2012 - 11:47 AM
Raving lunatic


Joined: Oct 30, 2002
Posts: 5769
Location: The Netherlands

At least 1984.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits