I’m probably not alone, but one thing I’ve loved since first being introduced to them is LCD screens. While most classes start off with basic line segment LCDs, the standard 20×4 character LCDs that used the Hitachi interface were revolutionary to me. However, they really forced me to take my programming and patience to another level. There wasn’t anything fundamentally difficult, but the number of wires, typically terrible documentation, and absolutely no feedback until the unit is properly initialized was maddening at times. 20 years later, while one can still choose that same Hitach style 20×4 character screen, there are much better options available.
One of my recent favorites is the Newhaven Display line, such as the NHD-0420DZ.
While still a 20×4 character display, it looks much better but is also much easier to use:
- 3.3V operation
- I2C operation allows for only two wire operation up to 400kHz baud rate.
- Many different formats available.
While the documentation available is better, without finding source code for your particular microcontroller / interface device, it can still be a time consuming and challenging process to first get the LCD to initialize. What would certainly be useful for me each time I go through this is oscilloscope information for the full initialization sequence from a working demonstration. In the case it is useful for someone else, attached is an image from my Siglent scope of the first few packets of information along with a table of the full initialization sequence.
I2C, Time, Address, R/W, Data
1,-18.4920us,0x78,W,0x00 2A
2,901.024us,0x78,W,0x00 71
3,1.81830ms,0x78,W,0x40 00
4,2.73834ms,0x78,W,0x00 28
5,3.65549ms,0x78,W,0x00 08
6,4.57501ms,0x78,W,0x00 2A
7,5.49232ms,0x78,W,0x00 79
8,6.40952ms,0x78,W,0x00 D5
9,7.32684ms,0x78,W,0x00 70
10,8.24399ms,0x78,W,0x00 78
11,9.16130ms,0x78,W,0x00 09
12,10.0786ms,0x78,W,0x00 06
13,10.9959ms,0x78,W,0x00 72
14,11.9134ms,0x78,W,0x40 04
15,12.8306ms,0x78,W,0x00 2A
16,13.7480ms,0x78,W,0x00 79
17,14.6672ms,0x78,W,0x00 DA
18,15.5864ms,0x78,W,0x00 10
19,16.5060ms,0x78,W,0x00 DC
20,17.4233ms,0x78,W,0x00 00
21,18.3428ms,0x78,W,0x00 81
22,19.2600ms,0x78,W,0x00 7F
23,20.1816ms,0x78,W,0x00 D9
24,21.0989ms,0x78,W,0x00 F1
25,22.0162ms,0x78,W,0x00 DB
26,22.9335ms,0x78,W,0x00 40
27,23.8507ms,0x78,W,0x00 78
28,24.7695ms,0x78,W,0x00 28
29,25.6326ms,0x78,W,0x00 01
30,26.6283ms,0x78,W,0x00 80
31,27.6385ms,0x78,W,0x00 0C