LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open and close visa inside a while loop

Same comment here about the VISA events.

 

Why are you doing a VISA close in parallel with a VISA read?  You have a race condition.  If the close occurs before the 53 bytes are read, you will lose those bytes.

0 Kudos
Message 11 of 15
(790 Views)

Even with them there is problem. You are right I can remove concatenate string.

Yes the antenna constantly sending data. What do you think can I keep open and close inside the loop? In this case working properly.

0 Kudos
Message 12 of 15
(790 Views)

Why is the antenna system sending data continuously?  That just confuses things if you are also trying to slip some command/request communication in the middle of that.

 

If the antenna only sent data when you requested it, that would be better.  Right now, it doesn't look like you are trying to read or do anything with that data besides the Read Position data you are actually requesting.

0 Kudos
Message 13 of 15
(786 Views)

The vi only works because VISA open (And Close. Clears the buffers.  the loop should be "Flush buffer (To get rid of the old outdated data) then, Read"   Write appears unnecessary since the device contunually spews the latest data to the buffer.  No need to wait for the button press either.  just keep up with the data.


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 15
(777 Views)

@sam009 wrote:

Yes the antenna constantly sending data.


Then I would create a second loop that does nothing but read that COM port.  You can then display/store the latest information.  You can use a queue or notifier to send that data back to your main loop.

 

You should probably also put your numerics in the event structure with their own Value Change event.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 15
(770 Views)