0
\$\begingroup\$

I made working code in an older microcontroller for a character based LCD that's based on the HD44780 chip.

My code stops execution of everything else every 70uS to display one character from the remaining characters that need to be shown. I chose 70uS because I believe that's the worst case scenario for timing.

I have seen command charts that say that the waiting time is only 40uS or 50uS and I seen one that says waiting time is only 37uS.

I am aware that the busy flag exists in the LCD but I also read online that it takes longer for a character to be recognized as completed if I depend on the busy flag. On top of that, I'll be required to put the LCD in read mode and poll the busy flag. I have it hardwired in write mode. (R/W pin grounded).

Rather than constantly modifying my code by playing with the fixed wait time value, Is there an ideal way in code to figure out the minimum wait time for a character to be processed on the LCD?

I'm using an 8051 based microcontroller but answers in pseudocode are fine. I just don't want my system crawling slow all because of an LCD.

In fact, at 70uS, filling up a 16x4 line display with characters means 64 characters + 4 commands to set starting row positions equals 68 bytes to send, times 70uS = 4760uS = 4.7mS which can be pretty high if this LCD is used in a system with a high-speed internet connection and the LCD data needs to be changed in real-time as data is received from the internet.

\$\endgroup\$
1
\$\begingroup\$

The datasheet for the display, or the datasheet for the exact controller IC used in the display should be your reference for worst-case timing, taking all variations into account.

Hitachi apparently no longer makes the HD44780, so you're going to be looking at datasheets for Sitronix ST7066U, or Sunplus SPLC780D or Winstar WS0010 or maybe others, depending on the display (and maybe what they could get cheapest the week it was made). You'll also have to check what clock frequency they've used (typically set by an external resistor).

Of course if you want your product to work with any HD44780-compatible display you'll have to use the slowest numbers of the lot (including the original).


That's the timing. With a modern micro you may choose to fill the display using an interrupt routine so you don't tie up the processor with wasted cycles in wait loops. For example a 50MHz Silabs 8051 will have heck of a lot of clock cycles available in tens of microseconds even after the context switch. More modern cores may have DMA processors that can operate without any intervention by the main CPU.

\$\endgroup\$
  • \$\begingroup\$ I'm still using old microcontrollers (AT89S52) because I can program them and even still I get a lot of clock cycles to play with between calls to the timer interrupt that prints a character to the display. Mine might be hd44780 controller because I ordered the display online from ebay and the only label I see on the display itself other than the pin names is 1604A. \$\endgroup\$ – Mike Oct 29 '18 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.