;) This forum is the property of Proton software developers

Main Menu

Simple Program to Operate a 2x16 LCD Character Display Module

Started by GDeSantis, Dec 04, 2022, 04:49 PM

Previous topic - Next topic


The attached program was used to operate a NewHaven 2X16 LCD Character Display Module.

The NewHaven display uses a Sitronix ST7066U controller which is a functional equivalent to the Hitachi HD44780 controller.
The program is quite simple in the sense that it places a simple text message on the display module and does nothing further.  It is an example only.

The program initializes the display module to operate in the 4-Bit data interface mode but does not use the busy flag to determine when the LCD controller is ready.  This means all time delays are longer than those specified in the datasheet to accommodate slower than normal LCD modules.

The display module RW line (pin 5) must be grounded for the program to function and the four data lines as well as the 2 control lines may be implemented on any available I/O pin of any port. 

Stephen Moss

Quote from: GDeSantis on Dec 04, 2022, 04:49 PMThe NewHaven display uses a Sitronix ST7066U controller which is a functional equivalent to the Hitachi HD44780 controller
I am looking at using a Midas display that has the ST7066U controller and so far everything I have found confirms the above statement that it is 44780 compatible.
However, the compilers Print command is 44780 compatible and I have used it may times with a 44780 display without issue, so if they are compatible did you write this because you were not aware of the compilers Print command or because you had to as the ST76066U is not as compatible with the 44780 as we are lead to believe and so the compilers Print command does not work with the ST7066U controller? 


Nice coding GDeSantis.

That is an excellent point Stephen. The compiler's alphanumeric LCD Print command is for the original Hitachi 44780 displays that were around in approx 2002, and sometimes the compatible displays are not quite the same, but that is generally the times required for the commands to operate within them, hence the Declares to change the command and data times that the compilers have.

If they are not fully compatible, I will see if I can obtain one and alter the compiler's library code to make it compatible with them as well, as a library include file.


I have never used the compiler's Print command; but will look into using it on my next project.

Stephen Moss

I now have one the the Midas alphanumeric displays I was looking at with the ST7066U controller, I swapped out the Hitachi I have with the 44780 controller for it and initial indications are that the Midas is working just as well with the compliers Print commands. 


Just downloaded this out of curiosity and I have to say, that is probably the best laid out, and easy to understand piece of code I have seen in a VERY long time. Step by step of how printing to an LCD works.



After reviewing the compiler's PRINT command, I believe its use is far superior to my earlier attempt to operate a 2x16 LCD Character Display by configuring PIC registers.  Many thanks to Les for the Positron Masterpiece.

An updated program is attached and as far as I can tell, the program works fine when driving the Sitronix ST7066U Controller.