LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write multiple commands into VISA USB buffer.

Solved!
Go to solution

Hello, 

 

I'm trying to read 4 digital gages using the Gage-Mux. The way you read a gage is to write R followed by the port numbers 01,02,03,04 (ex. R01 reads gage connected to port 1). In the example sketch, I made a flipflop circuit to swap the input going into the VISA Write Buffer terminal, this lets me get two of the reading from R01 and R01. What I'm trying to get it to do is send all four of the commands either at one time, if possible, and get 4 readings out or send each of the commands one after another with a delay in between to read the values. How would I go about doing this? 

 

I've tried: 

Case structure, but I couldn't figure out how to change cases periodically. 

Duplicating the entire sketch and trying to run them at the same time, but it gives an error, something along the lines of "VISA resource in use" 

 

Ex: 

Capture.PNG

0 Kudos
Message 1 of 5
(1,460 Views)

Hi,

 

use an array of commands instead of a boolean toggle!

Either rotate a fixed array or keep an index in a feedback node...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,453 Views)

What about something like this?

Kyle97330_0-1679443297886.png

Do all 4 queries concatenated, then all 4 reads.

 

If the instrument you're communicating was made "properly", it should have an input buffer where it will read in one command, execute it, and then read in the next one from the buffer and so on.  If it was made poorly then it might discard all pending data when it starts running a command, but there's no way to know unless you try it out.

0 Kudos
Message 3 of 5
(1,425 Views)

So this kinda works, but the device cycles through all the ports so fast that labview can only capture the last port. 

0 Kudos
Message 4 of 5
(1,384 Views)
Solution
Accepted by YPWORK

I don't know how well of a solution this is, but I just copied the code 4 times and replaced the commands. Then I put each of the codes into a flat sequence structure one after the other, since each sequence has a close visa function, the next sequence has no issue opening it up and running it. My next plan to improve this is to put the code into a sub-VI then have the commands be an input. This has worked for me so far! 

0 Kudos
Message 5 of 5
(1,375 Views)