LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCA9548A Multiple Addresses Issue

Hey guys. I've only used labview for about 2 months so please bear with me if it is something simple I overlooked. I'm trying to get 8 Sensiron SHTW2 through a TCA9548A multiplexer using the I2C bus on a NI USB-8452. All the sensors have the same address (0x70) I'm just cycling through the multiplexer addresses (Decimal values: 112-119 to indicate sensor 0-7) I've attached the code for reading the sensor/multiplexer. The data screenshots are from my Main VI.

Kevin1701_0-1581086160547.png

When I have a sensor isolated without the multiplexer and remove the section of code labeled "Address Multiplexer" the code works fine.

Kevin1701_2-1581087213099.png

When I attach the multiplexer and try to address individual sensors I start getting the same data for each sensor repeated every second.

Kevin1701_1-1581086601249.png

 

Thanks in advance! These forums have helped me a ton these last two months.

0 Kudos
Message 1 of 4
(2,954 Views)

Hi Kevin,

 

Without seeing the Main VI, I'm tempted to guess at one of the following (numbered for reference, not importance or probability):

  1. The multiplexing code doesn't work at all, and you're always reading the first/last/whatever'th element. Test to rule out - run the VI manually (I guess the Main VI uses a loop with the Ring input) and try two different inputs (that you know will return very different outputs, ideally, or where one is disconnected if that makes any sense...). If they are the same, perhaps this is the problem
  2. Since it appears this subVI does a bunch of initialization code stuff too, that may be somehow overwriting the settings on the multiplexer. Try moving the initialization code into a separate subVI before you run this VI in a loop?
  3. There is a timing problem with the reading vs setting of the multiplexer setting. I suspect this is quite unlikely, but perhaps? If you rule out the previous two points, try adding some waits after setting the multiplexer before sending commands?

GCentral
0 Kudos
Message 2 of 4
(2,891 Views)

Thanks for the suggestions! The multiplexer has the same address as the other sensors 0x70. When I thought I was writing to the sensor to specify the temp/humidity reporting style I was actually writing to the multiplexer a second time and opening a bunch of channels. Then when I was reading from the sensor it was giving me junk data. I was able to add a dab of solder to the multiplexer board to change the address to 0x71 to prevent this issue. Then I added a run script after I addressed the multiplexer and wrote the command bit for which sensor I wanted to read. I can read all 8 sensors now and have no more issues. 

 

Thanks for the help! If anyone is interested I can post the snippet of code. I saw there was a lot of confusion around these guy on the forums.

 

Message 3 of 4
(2,865 Views)

Hi Kevin1701

Could you please Share the snippet.

 

 

thanks,



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 4 of 4
(2,182 Views)