LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send Array of String element by element outside loop for to VISA Write

Hello,


Please, I want to send an array of string element by element to VISA Write, without putting the function VISA Write inside the for loop, my array contains a list of instruction to send one after the

 

other separated by a delay of 100 ms, I'm almost to the answer but I remain how to extract element by element from the loop and send them on VISA Write

 

Thanks to all.  

 

 

Ayoubas01_0-1652259355040.png

 

 

 

 

0 Kudos
Message 1 of 6
(1,540 Views)

Hi Ayoubas,

 


@Ayoubas01 wrote:

I want to send an array of string element by element to VISA Write, without putting the function VISA Write inside the for loop,


This doesn't make sense.

Call the VISAWrite inside an (auto-indexing) FOR loop!

Best regards,
GerdW


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

You can use the function "Array to Spreadsheet String" to convert your array to a single string that you can send to VISA with on call.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 6
(1,492 Views)

@paul_cardinale wrote:

You can use the function "Array to Spreadsheet String" to convert your array to a single string that you can send to VISA with on call.


Many instruments do not like it when you do that.  They like having time to process commands before another one comes in.  The OP did state that each command needs to be sent with a 100ms delay.  From another thread, I know this is coming straight from the instrument's user manual.

 

The real solution is to use a FOR loop with the VISA Write inside of the loop, autoindexing the array of commands.


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 4 of 6
(1,486 Views)

@crossrulz wrote:

@paul_cardinale wrote:

You can use the function "Array to Spreadsheet String" to convert your array to a single string that you can send to VISA with on call.


Many instruments do not like it when you do that.  They like having time to process commands before another one comes in.  The OP did state that each command needs to be sent with a 100ms delay.  From another thread, I know this is coming straight from the instrument's user manual.

 

The real solution is to use a FOR loop with the VISA Write inside of the loop, autoindexing the array of commands.


OK.  But it depends on the particular instrument and on the particular commands.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 6
(1,480 Views)

If the task asks for a FOR loop, you use a FOR loop (and it you need to stop early, add a conditional terminal).

 

Unless this is is some convoluted exercise, it makes no sense to limit yourself to a subset of the available tools.

Can you explain your aversion to FOR loops? Maybe they are misguided!

 

(So you are already using a FOR loop, but you are throwing everything away immediately except for the last value, misguided local variables, using fake (instead of real) autoindexing, control terminals inside a tight loop, etc. These are all indicators that you might need to work on your coding skills first. We can help!)

0 Kudos
Message 6 of 6
(1,453 Views)