This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PCF8574A IO Expander with nRF52-DK

Hi,

I'm trying to use PCF8574A IO Expander with a nRF52-DK board to display characters on an HD44780 LCD. I noticed that I have to use the function nrf_drv_twi_tx(). Since PCF8574A doesn't have a register address, how do I send commands and text to the LCD?

Thanks

Parents
  • The PCF8574A has an address, it has to have an address, it's an I2C device, I2C requires things to have an address. The address is whatever you set up on the A0-A2 pins.

    So you give the command the address of the expander and write a byte of data.

    I do have to ask however, since you have an nRF52 development kit which has masses of output lines just begging to be used, why do you need a port expander? Port expanders are for arduinos which come with about 1 1/2 pins available.

  • well that's not how that function works, it takes the I2C peripheral address plus a buffer of data and a length, that's it, and it writes the data to the device at that address. There is no concept in that function of a register address on the other side, it's just raw data.

    so nrf_drv_twi_tx() will work just as it is without rewriting it, and if you actually did set data length to zero then it wouldn't do anything because it wouldn't write any data. He wants data == the 8 bits of data he wants to send out and data length == 1

Reply
  • well that's not how that function works, it takes the I2C peripheral address plus a buffer of data and a length, that's it, and it writes the data to the device at that address. There is no concept in that function of a register address on the other side, it's just raw data.

    so nrf_drv_twi_tx() will work just as it is without rewriting it, and if you actually did set data length to zero then it wouldn't do anything because it wouldn't write any data. He wants data == the 8 bits of data he wants to send out and data length == 1

Children
No Data
Related