PCF8574 SDA/SCL Connect to GPIO?

Discussion in 'Embedded Systems and Microcontrollers' started by HellRyder, Sep 5, 2013.

  1. HellRyder

    Thread Starter New Member

    Sep 5, 2013
    1
    0
    Hello I want to ask a question. I currently need to use I2C chip which is the PCF8574.
    I need to interface it with LED, LCD and a 4x4 Keypad. The thing is, my microcontroller has no port specified for SDA and SCL. The name of my microcontroller is VSX-6116. Attached is the datasheet and list of available ports. So can I connect the 2 wire line which is SDA and SCL to the GPIO ports? Including the pull-up resistor required by the 2 lines.
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    Sure you can use any two pins for I2C.

    I2C works off open collector drivers, meaning a pull-up resistor makes the high level, and an output will pull down to make a zero. Such outputs are uncommon on micros but a micro can be made to work the same.

    The "trick" is you write a zero to the data bit, then use the direction register to control the level: set as output it drives low, set as input the resistor pulls high.

    You should find code examples on the web for this under "bit bang I2C."

    And welcome to the forum!
     
Loading...