LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VirtualBench - PCA9546 I2C Bus

Hi,

 

I have a following problem. I would like to ask for some help.

 

I would like to use PCA9546 I2C switch, with VirtualBench, and Labview.

This is the reading, and writing procedure.

PCA9546_RW.pngI develope code, in Labview 2019 and I use VirtualBench  I2C VIs.

My question. The PCA waits data, in the way what Figure 7 shows.

 

But. 

vi.PNG

According to the datasheet, I have to send 2 data package. 

 

If I use I2C Config Bus.vi, I send the slave adress too. Should I send the adress again, or I2C Config Bus is a kind of I2C Write VI? I am confused. Please give me further details about I2C Config Bus.vi. 

 

Thank you,

 

Have a nice day,

 

Gabor

 

0 Kudos
Message 1 of 4
(1,477 Views)

The address and the Write/Read bit are handled by the driver.  You just have to supply the byte(s) in the message data to write to the VI.

 

Are you getting an error?  Your code looks fine for a quick command.  For a long run, you really should not be initializing and closing the bus with each message.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(1,447 Views)

Hi crossrulz,

 

Thank you, for the details.

 

I wanted to try the I2C VIs. It works, without error. 

I didn't plan to close and reopen the bus. ( But, thank you for that advice! ) 

 

If I want to use the bus for a long term, I will start with my short code.

But, I wont close the bus. After that, I will switch the data lines as the Figure 7 shows.

 

Am I correct?

 

Thank you very much,

 

Gabor

0 Kudos
Message 3 of 4
(1,424 Views)

@GaborZatik wrote:

But, I wont close the bus. After that, I will switch the data lines as the Figure 7 shows.

 

Am I correct?


Once you open the session, you can do the Write, Read, and Write/Read as much as you want until you close the session.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 4
(1,415 Views)