LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1 Long SCPI CMD Single Write vs 1 Long CMD in Chunks vs Spliting CMD to Multi-Writes to VISA

Solved!
Go to solution

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):

 

Write_Chunks.png

 

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

0 Kudos
Message 1 of 3
(1,806 Views)
Solution
Accepted by topic author Mikejj

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.


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
Message 2 of 3
(1,783 Views)

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).

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 3
(1,758 Views)