06-04-2019 12:03 PM
Hello, I'm developing a program in LV and Arduino. At first I have a serial connection, I need to read the data sent by the arduino serial in LV, it happens that the data is sent very fast and I'm losing the data. This data I use to make a comparison in another function. What am I doing wrong?
Solved! Go to Solution.
06-04-2019 12:17 PM - edited 06-04-2019 12:20 PM
Here's some hints:
DON'T USE "BYTES AT PORT" in your LabVIEW code
Use the Arduino "Println" command as it appends a CR or LF or CR/LF, I can't remember at the end for you.
Enable the Termination Character in your VISA Serial Setup and set it to the same character
Set your VISA read to read far more bytes than you expect to receive
Now the VISA read will read until in receives the Termination Character or times out
06-05-2019 07:44 AM
Thanks for the help, I made the changes in Arduino and LV and it worked.
06-05-2019 09:13 AM - edited 06-05-2019 09:17 AM
DOH! Never mind I just noticed that was VISA CLR not VISA Read in your picture
06-05-2019 09:36 AM
I suspect the actual issue was not the bytes at port, but rather the case structure after it.
I cannot see what the other cases are, but the tunnel on the right of it looks to be set to "use default if unwired".
If you ever entered a case that was not explicitly wired through, the visa refnum in your class private data would have been overwritten with a default (essentially NULL) reference, then all subsequent methods aren't trying to access the correct resource.
Since the visa reference is a reference, it doesn't need wiring back in to the class private data (except in the case where you open or close or otherwise modify the reference).
0xDEAD