Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 69240

NI-9402 I2C - cannot write multiple bytes

$
0
0

Hello,

 

I'm using the NI-9402 to communicate to a sensor using I2C, and I'm having trouble writing 8 bytes to the sensor.  I'm attaching my block diagram VI.

 

For this I2C communication, what I want to do is to write:

Slave Address 4C; Write = 0; ACK | 0x0D ; ACK | 0x40; ACK | Repeated Start |

Slave Address 4C; Write = 0; ACK | 0x0F; ACK | 0x42; ACK; Repeated Start |

Slave Address 4C; Write = 0; ACK | 0x20 ; ACK | 0x01; ACK | Repeated Start |

Slave Address 4C; Write = 0; ACK | 0x21; ACK | 0x08; ACK; STOP

 

However, with the code that I have, I am seeing on the scope:

Slave Address 4C; Write = 0; ACK | 0x0D ; ACK | 0x40; ACK | Repeated Start |

Slave Address 4C; Write = 0; ACK | 0x0F; ACK | 0x42; ACK; STOP

 

If I stop the program and run again, I see the other two commands:

Slave Address 4C; Write = 0; ACK | 0x20 ; ACK | 0x01; ACK | Repeated Start |

Slave Address 4C; Write = 0; ACK | 0x21; ACK | 0x80; ACK; STOP

 

I am not able to write 8 bytes of data. I only see either the first 4 bytes or the last 4 bytes. How do I fix this issue? Any help would be appreciated. Thanks.


Viewing all articles
Browse latest Browse all 69240

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>