LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loss of data connection VISA and arduino

Solved!
Go to solution

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?


image.pngimage.png

0 Kudos
Message 1 of 5
(2,096 Views)
Solution
Accepted by topic author rafael.assis16

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

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(2,092 Views)

 

Thanks for the help, I made the changes in Arduino and LV and it worked.

 

image.pngimage.png

0 Kudos
Message 3 of 5
(2,043 Views)

DOH! Never mind I just noticed that was VISA CLR not VISA Read in your picture

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 5
(2,031 Views)

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

0 Kudos
Message 5 of 5
(2,022 Views)