8 years ago.

I2C LCD won't display anything

i'm using a HD44780 LCD 20x4 with I2C controller PCF8574A. i'm using nucleo - F411RE i tried uploading the example program (TextLCD_HelloWorld2) but it doesn't work. it turned the backlight off. here is what i modified :

I2C i2c_lcd(I2C_SDA, I2C_SCL); TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4);

the rest are the same. here is the pc.printf feedback :

TextLCD Enhanced Test. Columns=20, Rows=4 MemAddr(Col=0, Row=0)=0x00 MemAddr(Col=19, Row=0)=0x13 MemAddr(Col=0, Row=1)=0x40 MemAddr(Col=19, Row=1)=0x53 MemAddr(Col=0, Row=2)=0x14 MemAddr(Col=19, Row=2)=0x27 MemAddr(Col=0, Row=3)=0x54 MemAddr(Col=19, Row=3)=0x67 All my hard work took 0.112563 sec Bye now

Question relating to:

Hi, I've been to a very similar situation for the last couple of hours. Main board: LPC1768, i2c on pins p28 (sda) and p27 (clk), works flawlessly with an i2c oled display. But I'm in trouble with not one, but two PCF8574 drivers with 16x2 HD44780 displays. Each item works perfeclty in different environment (Atmel / Arduino IDE). Each port expander seems work properly, each send an ack for the address call (yes, they're on different address) as well as memory addresses of character positions (official example). Pull-ups are fine and in place. Contrast voltage is fine. Power is also fine. I've tried every setting of TextLCD_Config.h file for both displays. As far as I could find, there is no any output from the expander to the display (all lines, including data lines are all in steady state (high/low) on the scope's screen). All I got is a constant line of black rectangles on the top line, and empty on the bottom. Any advice, please, how to fix it? Yours sincerely, Tamás

posted by Tamas Szekffy 26 Aug 2017

2 Answers

8 years ago.

Hello Eka,

Here are some possible causes for your problem:

-Make sure the contrast voltage for the display is correct. Do you see any dark rectangles when the display is powered.

-Are you sure that the three PCF8574A slaveaddress selectlines are all high. This is needed to make sure the device responds to the I2C address (0x7E) that you provide in the instantiation.

-The component lib supports several options/modules for the wiring diagram between PCF8574A and the display. Make sure you select the correct one as explained on the notebook page

Find the following #defines in TextLCD_Config.h to select the appropriate module version.

//Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
//Different commercially available LCD portexpanders use different wiring conventions.
//LCD and serial portexpanders should be wired accordingly.
//
//Select Serial Port Expander Hardware module (one option only)
#define DEFAULT   1
#define ADAFRUIT  0
#define DFROBOT   0
#define LCM1602   0
#define YWROBOT   0
#define GYLCD     0
#define MJKDZ     0
#define SYDZ      0
#define WIDEHK    0
#define LCDPLUG   0 

Accepted Answer

Thankyou sir My problem was solved by changing the module version to lcm1602

posted by Eka Putra Leo Nata 25 Oct 2016

Great. So the wiring, I2C and PCF8574A are all fine. The 20x4 module should also work assuming the display is OK and it has a standard HD44780 controller or compatible. Do you have a typenumber or datasheet for the display?

posted by Wim Huiskamp 25 Oct 2016
8 years ago.

Hi Eka,

Have you had a look at the issues flagged here:

https://developer.mbed.org/questions/68719/i2c-not-working/

If not have you tried contacting the creator of the library for advice, I'm sure they would be glad to help and the best person :)

Best Regards,

Andrea, team mbed