Larry Bank Posted December 8, 2017 Posted December 8, 2017 This may be useful to some of you. I wrote some C code to talk to those common 2x16 LCD displays that are available in various colors from various vendors. My purpose in writing the code was to learn about the device and help document it better for other people to have an easier time using it. In my search for info, I only found poorly documented Python and Arduino code, so I thought I would write a C version and make it easy to read. You can find the code here: https://github.com/bitbank2/LCD1602
TonyMac32 Posted December 8, 2017 Posted December 8, 2017 2x16 I2C interface? Interesting. I was confused until I saw the picture, the HD44780 interface for those now has a kernel driver. I need to look at it and see if it can be run in 4-bit mode or if it has to go 8-bits wide. I've been lazy, I have a drawer full of the parallel displays... (good and cheap, and I'm usually using Cypress PSoC 5 controllers with tons of I/O)
Larry Bank Posted December 8, 2017 Author Posted December 8, 2017 5 minutes ago, TonyMac32 said: 2x16 I2C interface? Interesting. I was confused until I saw the picture, the HD44780 interface for those now has a kernel driver. I need to look at it and see if it can be run in 4-bit mode or if it has to go 8-bits wide. I've been lazy, I have a drawer full of the parallel displays... (good and cheap, and I'm usually using Cypress PSoC 5 controllers with tons of I/O) All of the ones I've been able to find on eBay and Aliexpress have the HD44780 paired with a simple I2C I/O expander. It just acts as a shift register and passes every write straight through to 8 data pins. The LCD can operate in 4-bit mode by sending a command of 2Xh - bit 4 sets the data bus width (see here https://learningmsp430.wordpress.com/2013/11/16/16x2-lcd-interfacing-in-4-bit-mode/). It allows having just the upper 4 data bits connected and the lower 4 bits from the I/O expander are used as control lines.
TonyMac32 Posted December 8, 2017 Posted December 8, 2017 Thanks for the reply, I was wondering about the driver. ;-). Even in my test equipment I run them 4 bit, it's just easier wiring.Sent from my Pixel using Tapatalk
Recommended Posts