From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open and close visa inside a while loop

Hi,

I need to read a position from a control unit device continuously or even by click a button, for this I have to put "visa configure serial port" and" "visa close" inside a while loop. Dose it make any problem?

0 Kudos
Message 1 of 15
(3,727 Views)

It could slow down your code.  It could cause you to miss bytes while the port is closed depending on how you are handling the serial communication overall.

 

Why do you "have to put" them in the loop?

 

 It might work just fine, or it might cause problems.  I wouldn't recommend it.

0 Kudos
Message 2 of 15
(3,726 Views)

Thanks for reply,

If I don't put inside the loop, the position reading comes with delay and I have to click several time the button to shows the correct value!!!

0 Kudos
Message 3 of 15
(3,722 Views)

Then something must be wrong with your code.

 

You need to post your VI so we can look at it.

0 Kudos
Message 4 of 15
(3,711 Views)

Sounds like a "Flush buffer" before each read is needed to get rid of "Old" data being "Spewed Asynchronously" from the device on the other end.

 

What is the device? (Make/Model)


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 15
(3,700 Views)

The programs are attached for continues reading and by clicking. 

The device is a Control unit for antenna.

Download All
0 Kudos
Message 6 of 15
(3,694 Views)

Sorry...It seems the attachments are not readable I will attaché them again.

0 Kudos
Message 7 of 15
(3,688 Views)

Attach the .vi, not pictures.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 15
(3,684 Views)

I attached the vi,

 

Download All
0 Kudos
Message 9 of 15
(3,669 Views)

You shouldn't need the VISA Event nodes.  Get rid of those.

 

Why are you using Concatinate String just to build up a constant.  Just create a single string constant.  It is a lot cleaner.

 

Is the antenna constantly sending data to you or only when you request it?


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 10 of 15
(3,646 Views)