LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using I2c Communication with MyRio

Hi All,

 

I am trying to write to a haptic controller through I2c with the My rio device, however, I am having trouble implementing it. My understanding is that I need to first open the channel, configure the channel and then I can use write commands. When I am finished with the I2c I then close the channel.

 

For my specific project, I am using a multiplexer to communicate multiple channels of the same i2c address. When I send a command to the multiplexer it tells it which haptic controllers to pass the i2c information to. So I first open the channel, then configured the channel. My first write command is to a multiplexer to open up the channel (address 0x70, command 0x0F to open up four channels)(which doesn't produce any errors). However, when I use a second write command to the haptic controller (address 0x5A, data [ bytes 0x01 then 0x05]) it then gives me an error - apparently other people of said the code I am getting is from not receiving an ack bit back. Is there something that I am missing or should be doing differently. I shouldn't be closing and reopening the I2c every time I change the address I am communicating with should I?

 

Any help is greatly appreciated,

 

Regards,

Benjamin

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

Hi All,

 

I am trying to write to a haptic controller through I2c with the My rio device, however, I am having trouble implementing it. My understanding is that I need to first open the channel, configure the channel and then I can use write commands. When I am finished with the I2c I then close the channel.

 

For my specific project, I am using a multiplexer to communicate multiple channels of the same i2c address. When I send a command to the multiplexer it tells it which haptic controllers to pass the i2c information to. So I first open the channel, then configured the channel. My first write command is to a multiplexer to open up the channel (address 0x70, command 0x0F to open up four channels)(which doesn't produce any errors). However, when I use a second write command to the haptic controller (address 0x5A, data [ bytes 0x01 then 0x05]) it then gives me an error - apparently other people of said the code I am getting is from not receiving an ack bit back. Is there something that I am missing or should be doing differently. I shouldn't be closing and reopening the I2c every time I change the address I am communicating with should I?

 

Any help is greatly appreciated,

 

Regards,

Benjamin

0 Kudos
Message 2 of 4
(3,672 Views)

Hello BenSF,

What is the error code you are seeing? It would be helpful to know. Are you using LabVIEW? If so, can you attach the vi you created?


Zofia
NI Technical Support Engineer
0 Kudos
Message 3 of 4
(3,630 Views)

Attached is the labview file and an image of the code. The error message I get is "Error -363011 occurred at myRIO v1.0 Write I2C.vi". In the image you can see probe 1 and probe 2. Probe 1 (after first write command) receives no error, but Probe 2 (after second write command) gets the above error.

 

Thanks,

Benjamin

Download All
0 Kudos
Message 4 of 4
(3,621 Views)