HD44780 Replacement Display Stuck in Initialization - Page 1
Forum section: electronics / beginners

author: Mp3
author_rank: Frequent Contributor
timestamp: March 22, 2021, 12:11:12 am
content: I'm looking to replace an old and faded 16x2 character display at the end of its life. The exact part number is Sharp N1066CP which I did not find a datasheet of. I thought it would be HD44780 compatible but it might not be.I got some cheap generic 16x2 blue LED displays on ebay, as I have had success swapping HD44780 displays with this:https://www.ebay.com/itm/1602-16x2-HD44780-Character-LCD-Display-Module-LCM-Blue-Blacklight-for-Arduino/122000940646At first I tried all the 16x2 LEDs I had and it did not show anything on the new display at all. After moving the variable resistor for the contrast pin, i was able to eventually get the row of blocks on top row indicating the display is stuck in initialization.I also took a working, authentic HD44780 from the shelf. Same issue, took some fiddling to get the blocks on the screen, but the same problem remains.As a test, I tried putting a 1/8w 4.7k ohm resistor in series with the contrast pin of the LED display, but that burnt out the resistor. I figured i would ask before trying again with a beefier resistor.I was looking thru the datasheet of the display i have to see if there was a way to force it into 8 bit mode so it might initialize properly...Here are the datasheets of the display i am using....https://www.buydisplay.com/download/manual/ERMC1602-2_Datasheet.pdfhttps://www.buydisplay.com/download/ic/SPLC780.pdf

author: srb1954
author_rank: Super Contributor
timestamp: March 22, 2021, 03:05:05 am
content: Quote from: Mp3 on March 22, 2021, 12:11:12 amFrom what I can recall using the 44780 based displays they always started out in 4-bit mode. There was no option to force them to start in 8-bit mode and it was necessary to go through a complicated set of commands to switch to 8-bit mode.Between sending each command there was a requirement for certain time delays to ensure that the previous command had completed. These delays are crucial and are clearly specified in the data sheet.Check your timing for conformance with the datasheet parameters.

author: pqass
author_rank: Super Contributor
timestamp: March 22, 2021, 04:57:45 am
content: See following YouTube video walkthrough on how to program the 44780.There is a 8-bit-mode command see @12:50 and discussion about timings @18:40.However, I encourage you to view it entirely.It's quite good for beginners or anyone that wants to bit-twiddle rather than just using libraries.He even demonstrates that anyone can issue the initialization sequence using toggle switches alone; no microcontroller required!

author: Mp3
author_rank: Frequent Contributor
timestamp: March 22, 2021, 05:19:18 am
content: Quote from: pqass on March 22, 2021, 04:57:45 amYou know, in a full day of googling, I didn't check youtube once, and this one video would have saved me a whole lot of trouble. So thanks for the reference as well as the note to look into the device's programming for the answers I needed

author: amyk
author_rank: Super Contributor
timestamp: March 23, 2021, 12:26:05 am
content: Are you sure the pins are connected correctly? Different modules may vary in pinout. Use a logic analyser on the bus to make sure.

author: Andy Watson
author_rank: Super Contributor
timestamp: March 23, 2021, 01:10:13 am
content: This:Quote from: srb1954 on March 22, 2021, 03:05:05 amis important. You must give the display time to complete its initialisation steps - otherwise it gets stuck. Also, I have had several "cheap generic" ebay clones that behave as datasheet specifies except for the fact that their internal clock runs four or five times slower - so you have to allow extra time for their initialisation sequence.

author: gnuarm
author_rank: Super Contributor
timestamp: March 23, 2021, 03:21:50 am
content: I am concerned about the burnt out resistor!!! The contrast control is just applying a voltage to the end of a high value resistor chain to set the voltages of the various LCD drive states. Very little current should flow, microamps only!So figure out what you did wrong with the resistor before you do anything else.The initialization procedure of the HD44780 controller chip is not at all complex to do. It simply must begin with setting the interface to 8 bit mode because that is the only way to set the mode to a known state. From there you can set the mode of your choice even over a 4 bit bus.The wikipedia description of this process was a bit complex I thought, so I straightened it out a few months ago. It should be a simpler read now.https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller#Mode_selectionThe problem is the controller reset does not work unless the power comes up in a specific manner which often does not happen. So you can't know if the interface is in 4 bit mode or 8 bit mode. That's ok, because the 4/8 bit mode can be set with a command sent overt a 4 bit hardware interface.Essentially, because you don't know the starting bus mode (it can be any of three states, 8 bit, 4 bit first bus cycle or 4 bit second bus cycle) you have to send the same single bus cycle command for setting the interface to 8 bit bus mode three times. Now you can be certain the chip interface is set for an 8 bit bus. If you have 4 bit wide hardware send a single bus cycle command to set the 4 bit bus mode. Now you are in the mode that matches the hardware and you can send the full set of configuration commands in the selected bus width mode.The timing is a bit different from what the data sheet indicates. The numbers they use are "nominal" or typical and do not take into account the variation in clock speed over temperature, voltage and process. Notice the heading in the table for timing says, "Execution Time (max) (when fcp or fOSC is 270 kHz)". 270 kHz is the typical rate at 5V using a 91 K resistor. If you use a 5V module at 3.3 volts it slows further. I think the numbers below also factor that in to be truly universal, but I don't recall for sure. Someone check my math from the graphs on page 55 of the HD44780U data sheet.The Clear and Home commands are listed as 1.52 ms, but with tolerances should be given 2.51 ms. The remainder of commands are listed as 37 us, but should be given 61 us to execute. Hmmm... checking my math I think I did not include a voltage change. So in the worst case using a 5V module on 3.3V the timings should be further slowed a bit.