05-11-2022 03:57 AM
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.
05-11-2022 05:28 AM
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!
05-11-2022 07:13 AM
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.
05-11-2022 07:44 AM
@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.
05-11-2022 07:50 AM
@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.
05-11-2022 07:54 PM - edited 05-11-2022 07:56 PM
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!)