02-24-2020 05:46 AM
Hi All,
I am trying to program the LIST/Sequence mode on an ELOAD. This load can take up to 10,000 steps in a list and the SCPI command format goes something like this:
PROG:STEP<n>:LEVel
where n is the step number. If I have say...100 steps, then I will need to issue this command 100 times; 1000 steps, 1000 commands, and so on. Some of you might already see where I am going with this based on my topic...
My default go to solution would just be creating the commands in a array and feed it to an auto indexing for loop with a VISA Write inside. However, the wise-guy part of my brain is thinking I can somehow send this thing is one big chunk by using a semicolon ";" to build up all the commands into one giant string.
The immediate redflag with the giant string method is I am thinking somewhere along the way as my list gets to a certain size, I am going to get some I/O buffer errors since the string is going to be huge. So I thought of using something like this to send it in chunks (credit to whomever wrote this original driver, this is from the Lecroy MAUI oscopes):
So in the end I came up with 3 methods of doing this:
a. Send the command n times based on size of list
b. 1 giant SCPI string for n commands
c. 1 giant SCPI string split up in packet chunks to write
I am leaning towards "a" or "c" as I think "b" will run in to eventual buffer issues. However, I am not sure if "c" will even work...I am not really understanding how the IO buffer works. Even if I send it in packet chunks, wouldn't it eventually still overrun the buffer since I am not sending a terminating message until the whole SCPI string is sent?
Regards,
Mike
Solved! Go to Solution.
02-24-2020 07:40 AM
Combining commands is often a hit-or-miss, depending on the commands and the instrument. So I would lean towards A (all steps sent individually). It is also a lot simpler for anybody in the future (including yourself) to have to debug this code.
02-24-2020 10:49 AM
Computers are VERY good at doing repetitive tasks over and over without getting bored. I would take advantage of this by going with your original plan. And, as mentioned, it's a lot easier to debug. I will usually choose readability over performance unless performance is critical (e.g., I have to get this all done in one RT time slice) or the trade-off is unacceptable (e.g., making it easy to modify and debug makes it take 5 minutes to complete instead of 5 seconds).