ActivityBot HD44780 PCF8574 i2c lcd text not displaying

LosDavidosLosDavidos Posts: 7
edited 2016-04-15 - 13:11:55 in Microcontrollers
Hi
I connected HD44780 lcd via PCF8574T and I'm trying to send some text to display but it's not workig.
I can manage display (trun on/off backlight, set cursor), but when I'm sending text nothing happens.
I found libraries with description that it should work but it's not.
My code
#include "i2ceasy.h"
#include "simpletools.h"
#include "i2clcd.h"

i2ceasy *i2cbus;
i2clcd *lcd2004;

int main()
{
i2cbus = i2c__init(4, 5); // SCL pin, SDA pin

lcd2004 = lcd_init(0x27, 2, 16);
lcd_backlightOn();
lcd_setCursor(0, 0);
lcd_print("Text line 1");
lcd_setCursor(1, 0);
lcd_print("Text line 2");
pause(5000);
lcd_backlightOff();

}

I tried this display on arduino and it's working fine.

Comments

  • Can you provide a link for the I2CEASY library? Google finds nothing.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • Have you included the necessary pull up resistors to the SCL and SDA lines?
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    My first thought was that you're able to send commands, but not data. Makes me think the RS line isn't working. When sending commands the RS line should be LOW. When sending data it should be HIGH.
    Chris Savage | Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+
  • I attached screenshoots of my connection.

    2ntzcxh.jpg

    qs9n4n.jpg

    That's everything I made. I expect it's not working, because I don't have pull up resistor like Hal said.
    Can you tell me how should I calculate resistance, or where I should look for?
  • I have found 3.3K (orange, orange, red) or 4.7K (yellow, violet, red) to work quite well. Probably best to hook them up from the i2c lines to +3.3V.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • I made connection like this:
    14ndct5.jpg
    but still not working
  • Can you attach a ZIP file of the entire project so we can load and troubleshoot your software?
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • LosDavidosLosDavidos Posts: 7
    edited 2016-04-18 - 13:38:32
    In libi2clcd folder there is my sample project libi2clcd.side. I attached libi2ceasy as library for project.
  • Not what we need. What I asked for was a zip file of your project.
    With the project open in SimpleIde click on the Projects Icon and from the drop down click on Zip. Provide a descriptive name and press save. Then attach the zip file to your post here. This way we can see how your project is set up, which modules are included and how they interact. It will also allow us to see any errors and warnings at compile time.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    It looks to me like the backpack has two 4.7K resistors which I am assuming to be the pull-ups on the SDA/SCL lines (though I could be wrong, I have no schematic). Since the commands are working but not data I was wondering if the RS line on the LCD wasn't properly connecting to the backpack.
    Chris Savage | Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+
  • Some thoughts:
    Chris' post has me wondering if the I2C backpack connections are standard or up to the whims of the designer. I have a 20 x 4 lcd module with a 12c backpack and the connections from the PCF8574T are as follows:
    1 +5 (A0)
    2 +5 (A1)
    3 +5 (A2)
    4 RS
    5 RW
    6 EN
    7 BL
    8 Gnd
    9 DB4
    10 DB5
    11 DB6
    12 DB7
    13 n/c (/INT)
    14 SCL
    15 SDA
    16 +5
    As best as I can tell the i2clcd.h file does define the control lines RS, RW, EN, and BL accordingly.
    I'm now wondering if the your backpack may be wired differently.
    Also, the address used in the program, 0x39 would indicate addressing a PCF8574AT device with A0 hi and A1 & A2 low. Your device may or may not be the 'A' device. You should check the connections from the backpack to the lcd module and positively determine what the connections are and which device is on the backpack, PCF8574T or PCF8574AT, the addresses are different.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • LosDavidosLosDavidos Posts: 7
    edited 2016-04-19 - 09:23:19
    Hi.
    I made zip. It's in attachement.
    My backpack is PCF8574T. I made tests on arduino and it's working, so I tought it could works same on activitybot. Address used in program is 0x27, I checked it. My lcd module is 16x2 and it's described like this (1-16):
    VSS
    VDD
    V0
    RS
    RW
    E
    D0
    D1
    D2
    D3
    D4
    D5
    D6
    D7
    A
    K
  • OK, you say the device on the backpack is a PCF8574T, you have tested this display on an Arduino and it works fine. You state that the address is 0x27 which comports with the device you have, IF pins 1, 2, and 3 are connected to +5. However, the program in the zip file you attached is still using address 0x39, which is an address for a PCF8574AT.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • Sorry, but you are wrong. Zip file is using 39 which is 0x27 in hex. I tried different combinations with this address but still not working.
  • JonnyMacJonnyMac Posts: 6,156
    edited 2016-05-15 - 02:32:19
    I write in Spin so I cannot offer code help, but I have bought a few of the PCF8574 backpacks and they are not all equal. Some use the PCF8574 while others use the PCF8574A which has a different slave ID. In the initialization of my Spin object, I attempt to connect to a PCF8574; if it is not detected then I try the PCF8574A.

    This code is in Spin, but easy to understand.
    pub start(sclpin, sdapin, addr)                                 
                                                                      
    '' Initializes LCD driver for PCF8574/PCF8574A using I2C buss                          
    '' -- addr is %000 to %111
                                                              
      i2c.setupx(sclpin, sdapin)                                    ' connect to buss
    
      devid := PCF8574 | (addr << 1)    
      ifnot (present)
        devid := PCF8574A | (addr << 1) 
    
      if (present)
        ms001 := clkfreq / 1_000                                    ' calcutate ticks/ms                                                                 
        setup_lcd                                                   ' initialize lcd for 4-bit mode
        return true
      else
        return false
    
    
    pub present                                                      
                                                                     
      return i2c.present(devid)
    
    These are the program constants:
    con
    
      PCF8574  = %0100_000_0
      PCF8574A = %0111_000_0
    
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
Sign In or Register to comment.