I2C LCD Interface Module

Discussion in 'Embedded Systems and Microcontrollers' started by R!f@@, Mar 19, 2016.

  1. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    I bought this from Aliexpress

    I am trying to learn serial LCD programming.
    I read some where that this module will have an address. I cannot see from the listing any device address.

    The seller is asking to send a video. How can I send a video if I dunno the address to try a code.

    Any idea on this any one ?
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    Get the datasheet for the IC. In cases like this, the address is limited to a handful of possibilities which might be selected by 0 Ω resistors on the board.
     
    R!f@@ likes this.
  3. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,010
    3,785

    Check section 8.3 of this document (the IC on the Ali Express device you linked)
    http://www.ti.com/lit/ds/symlink/pcf8574.pdf

    You will have to determine how the chip is connected (to high or low) on pins A0, A1, A2. Typically they are connected to ground, so the I2C addresses are the top row of this chart for read and write.

    image.jpg
     
    R!f@@ likes this.
  4. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    @GopherT How did you know that was the device on the board? I couldn't find any mention of it in the link.
     
  5. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    The data sheet is the same device. So I guess I have to short the pins. Eh!
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    No! What you have to do is read the datasheet carefully. It may be the case that the pins have internal pullups or pulldowns and will have a default behavior even if they are floating.

    Let me repeat myself -- you NEED to read the datasheet carefully, and then you need to look at the board carefully to see what is happening on those pins. The only reason NOT to use the default behavior is that you have multiple devices in the same system, OR you have two devices that default to the same address.
     
  7. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,010
    3,785
    On the Ali Express link in post 1, you can zoom into the picture enough to read the part number (I had to turn screen brightness all the way up). It says

    TLPCF8574
    HA
    AN
    ID

    down the left margins so the TL beginning threw me a big but one I turned up the brightness, I noticed why the TL was not part of the part number.
     
  8. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    OK.
    So I just short A0 to ground. How's that?
     
  9. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    Are you sure you can do that safely? Are you convinced that it is not already shorted to GND?
     
  10. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,682
    900
    If you are referring to creating the "write" address from the read address, that is not what the datasheet means for you to do. The basic "address" is "0x40" when all of the address pins are low. So a write would be 0x40, and a read address is 0x41. However, for illustration, let's assume your device is wired like the 2nd example, namely A2=L, A1=L, and A0=H. That gives you a 7-bit binary: "0100001". If you left justify it (as TI apparently does) then it is read as 0x42, i.e., 0100|0010. When you make a write command and send as a single byte, you still send 0x42. But if you send a read command, then the byte is 0100|0011. In other words, you do nothing to the A0 bit.

    upload_2016-3-19_14-10-24.png
    The convention that TI follows is not followed by all chip makers. As an example, Maxim with the DS3231, which is used in RTC modules, right justifies the 7-bit address in its datasheet. It gives the address as "0x68" , i.e., binary 01101000; however, in sending the read or write commands, one must left shift the "address" and add a one, which gives a write command byte of 0xD0 and a read command byte of 0xD1.

    I am not disagreeing with anything that has been said by PB or GopherT. You (R!f@@) just need to determine the status of bits <A2...A0>. You don't do anything to A0 to change from write to read.

    John
     
    R!f@@ and Papabravo like this.
  11. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    I'd check to see if A2, A1, A0 are already shorted to GND on the board. In the words of the Magic 8-Ball...Chances are good!

    https://en.wikipedia.org/wiki/Magic_8-Ball


    OK, so that wasn't one of the standard answers.
     
  12. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    Thanks all.
    I checked the module. The picture is same as in the listing in post #1. No jumpers soldered in Address A0,A1 and A2 pads. I will take it to the workshop tomorrow and check with DMM to see where they lead to.
    I do not think I would be needing to read from LCD. Never had to before. This will be used ONLY to display messages as that is all I need to do for my projects like I did in my last project. Since it is working I am planning a second one ( may be better). But for this I wanna use the serial LCD, as the wiring is really less than in 4bit wiring.
    So I believe I need only write address.

    By the way I drew up a quick sketch on how it will be connected. Please take a look at the pdf and comment.
    PS..Do I need pull ups on I2C lines, if so what is recommended value
     
  13. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,387
    497
    Generally, and from my very limited experience with I2C, you don't need pull ups if the wires are short, about a foot.
     
  14. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,682
    900
    I would leave reading the GLCD /LCD open. It is just a software function, and you never know when you will want to change a pixel or two. Agreed that to get it going, forget about reading.

    John
     
  15. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    will it help to wire pull ups on I2C bus

    {ED}
    The pads close the edge of the board are all GND's

    The upper Pads of A0,A1 and A2 are connected to pin 123 of the IC. PCB has 10K pullups on all 3 pins.
    So what now ?

    {edit, AGAIN}

    So I checked around and this link says short all for address 0x20.
    and this link says open all for address 0x27

    Is that how it is ?
     
    Last edited: Mar 20, 2016
  16. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,010
    3,785
    The address is set at the factory that makes the serial to parallel adapter. The Address pins are already pulled up to Vxc or connected to ground.

    The best option is to apply power to the I2C module and then measure the voltage on the A0, A1 and A2 voltages. Of they are all at zero volts from ground, and 5 volts from your supply, you can assume they a grounded. If not, record the status as high or low on each pin. Then look at the table that I posted above and use the appropriate address for however the factory configured the three address pins.
     
  17. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    Checked.

    A0,A1 and A2 are all high including the I2C bus

    So address is 0X4E
     
  18. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,010
    3,785
    I hope it works. Cheers
     
  19. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,010
    3,785
    Were those voltages measured at pins 1, 2 and 3 of the IC or the PCB pads labelled A0, A1 and A2? You should measure at the IC pins.

    It looks like the board designer gave you some options, he allows you to put jumpers on those pads to set the address yourself if you don't like the default option. The default appears to be set by the pill up (pull down?) 10k resistors (103) on the bottom of this photo. Connect jumpers (less than 100 ohm) across this pads as needed. If this is the only I2C on your buss, leave it as the default address, just measure the default address at the IC pins when you do measure with power applied to the board.
     
  20. R!f@@

    Thread Starter AAC Fanatic!

    Apr 2, 2009
    8,750
    759
    The pins and pads are the same
     
Loading...