LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Labview Interface to read from PCA9557 port expander

I am trying to read the data on the PCA9557 port expander.  See attached schematics for the set up.  I have the address (a0-a2) set as 010, with the fixed address as 0011, so the address for the i2c should be set as 26 (0011010), but please verify.  Also see attached Labview block diagram. 

The program is able to inialize the Arduino as well as i2c, but fails when it processes through the i2c read operation, basically times out (100ms) when it couldn't get a response from the i2c slave. 

I believe the i2c data and clock lines are already internally pulled up at 5V inside the arduino.  I'm using the Arduino mega with ATMEGA2560. 

Please help. 

Download All
0 Kudos
Message 1 of 5
(3,954 Views)

The first thing that I notice is that you are not writing anything to the device first.  You must always write something to the device first otherwise it doesn't know what you want.

0 Kudos
Message 2 of 5
(3,283 Views)

The data byte is hard coded as you can see from the schematics.  It is simply a 1 (P0).  Even if I don't write anything the data byte is defaulted to something.  In this case the Arduino is not getting a response from the chip. 

0 Kudos
Message 3 of 5
(3,283 Views)

There are four registers for this device.  You have to specify which register you want to read in order for it to transmit any data.  The register descriptions are on page 8.  So, you need to first write the register to the device and then read 1 byte back.

Note that this is based on past experience with every single I2C device that I've ever used.  I've not had time to look over the datasheet thuroughly yet for this device.

0 Kudos
Message 4 of 5
(3,283 Views)

Got it, thanks for your help!  I guess you need to specify with register to read from (perform a write operation).  In this case use byte 0-3 as input to the write sub VI.

0 Kudos
Message 5 of 5
(3,283 Views)