0
\$\begingroup\$

I have a character LCD that I'm trying to get working. It's an AZ Displays 16x4 character LCD. The backlight works perfectly, but there is no display (not even those little boxes that you expect on the first couple of lines.) The contrast is pulled to ground with a 10K resistor.

I had it working on Friday, but it suddenly stopped working on Monday (no firmware changes.) I tried two other LCDs, but they didn't work either. It was the exact same deal. I checked continuity and voltage in all of the wires, and they looked good.

The only thing I saw was that the timing was off for the control pins on the oscilloscope. Using the STM32L5, I tried creating a nanosecond resolution timer in order to enforce the timings, but I couldn't get anything accurate enough.

Worse yet, AZ Displays does not post any form of initialization procedure for their character LCDs on their datasheets. They give the functions, wiring and electric characteristics, timing, and that's it.

This is my algorithm for the initialization:

Clear RS/RW
Set enable line
Set function (1, DL=1, N=1, F=0)
Clear enable Line
Set RS/RW
Delay 1 ms
Clear data 
// Another character LCD did the function set twice and 
// delayed 37 microseconds
(repeat this once more)

// Run the following algorithm for display set, clear and entry mode 

Clear RS/RW
Set enable line
Set data
Clear enable line
Set RS/RW
Delay 2 ms // Commands will take at most 2 ms to complete

do
Clear data
Clear RS && Set RW
Set enable line
Delay 1 ms
Read busy flag and break if false
Clear enable line
continue // This reads the busy flag until command completes

I can't figure out why the LCDs are not working, and AZ Displays does not give much information on programming their character LCDs.

Any idea what's going on?

Edit: This is the datasheet for the LCD.

Update: Still not working.

@brhans The oscilloscope indicated that the minimum timing requirements were not being respected. The reason I set the enable line the way I did was that the timing diagram indicated the following algorithm:

Set RS/RW (1 or 0)
Set enable
Set data
Clear enable
Clear RS/RW

@Justme The voltage at contrast is 2.24 V. The datasheet indicated that the potentiometer could be between 10K and 20K ohms, and I tried 10 and 15 K, and neither really had any impact on the display (or lack thereof).

@Kartman A 300 ms delay had no effect.

@Finbarr I adjusted the function set part of the algorithm so that it was only done once. The function set was 0b00111100. Unfortunately, adapting to the algorithm set by the KS0066 did not help.

@Andy aka That's definitely a good idea. I should call them.

\$\endgroup\$
11
  • \$\begingroup\$ Where do you get the idea that you need nano-second resolution timing? As long as your signals respect the minimum time spec there is no maximum period - you just need to make sure that you're driving them "hard" enough that the rise and fall times are fast enough. \$\endgroup\$
    – brhans
    Mar 31, 2022 at 13:20
  • \$\begingroup\$ Here's their website: azdisplays.com - send them an email. \$\endgroup\$
    – Andy aka
    Mar 31, 2022 at 13:21
  • 2
    \$\begingroup\$ I've never seen a 16x4 display work when contrast was pulled to ground. Connecting the wiper of a 10k pot is specified because, well, umm, because it's needed. Other pot terminals connected to Vcc and Ground. \$\endgroup\$ Mar 31, 2022 at 13:26
  • 1
    \$\begingroup\$ What voltage is at contrast pin? Simply pulling contrast pin down with a 10k resistor sounds like a problematic scenario which does not result into large enough LCD panel driving voltage. \$\endgroup\$
    – Justme
    Mar 31, 2022 at 13:27
  • 1
    \$\begingroup\$ 2.24V at contrast pin still sounds incorrect. Please check connections and adjust pot so contrast pin has lower voltage. \$\endgroup\$
    – Justme
    Mar 31, 2022 at 14:21

2 Answers 2

3
\$\begingroup\$

The display is a generic device with aKS0066 controller chip, which is a clone of the original Hitachi HD44780 series of chips.

Data-wise, should work with any HD44780 compatible driver, so you can just use many true and tried solutions to test the display.

Hardware-wise, the LCD driving voltage must be about 4.5V, so with a 5V supply, the contrast pin shouls be set to 0.5V. A 10k resistor to ground will not work, a 10k potentiometer can work.

Care must be taken if you want to use 4-bit or 8-bit bus mode. A common caveat is to do the initialization sequence incorrectly which must be crafted to handle the initialization properly in all cases. Most existing libraries should be good enough for testing if you are using the 4-bit mode.

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

It turns out it was the contrast, as a couple of users had indicated. A 2k resistor was sufficient enough to give a .72 voltage drop, and now I have a display.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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