LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time issue in sending and receiving hex values from serial.

Hi guys, I want to read an integrated sensor that communicates via I2C protocol with my pc. Before that, just to see if my sensor works properly, I am sending a 'test command' (0x01, 0x05, 0x00, 0x31) according to the datasheet. The sensor should respond with the message (0x01, 0x05, 0x02, 0x55, 0xAA , 0x7D). I have a while loop where i constantly read six bytes from the serial and an event case triggered by a boolean button in order to write the 'test command'. It works, but the problem is that i have to wait almost 10 seconds after my writing command to actually see the sensor response. I tried with coolterm as a serial terminal and the sensor responds immediatly. I hope that you can help me with that. Thank you very much.

0 Kudos
Message 1 of 3
(862 Views)

Without knowing anything about the sensor we can only guess.  But, I have a high success rate guessing 😀

 

It sounds like the device is timing out on its read side because it is expecting some message termination.  RTM or use NI SPY to see what cool term is adding and you aren't. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 3
(849 Views)

That wait time is the default time out.

 

You can lower the time out, but that doesn't change the fact that you don't know what's going on.

 

If you get that data, and then press stop, the loop is in it's 2nd iteration, waiting for that time out. The Boolean is already read, so the next (3rd) iteration the loop will stop.

0 Kudos
Message 3 of 3
(841 Views)