Products > Test Equipment
SCPI best practices
uliano:
I'm having hard time to understand the SCPI interactions.
I "write" some command (for example to set a parameter or to switch to a mode) to the instrument and it does not answer anything. I have no idea if the command succeeded or not other than querying the instrument (for the parameter value or the current mode).
when sending sequences of commands I had *more than occasional* "command failures" that could be eventually amended by inserting a long enough delay between commands.
This delay is always (at least in my units, mostly Siglent) undocumented and differs not only among instruments but even between commands of the same unit.
Am I missing something?
How do you deal with this other than experimentally finding the "right" delay for each command?
(there should have been the *OPC? query that I expected returning 1 only AFTER previous command had been completed but it doesn't seem to cure, only time.sleep(the_right_amount) after each write has any success for me)
tszaboo:
I don't think you are missing a lot.
Some commands allow setting and querying at the same time.
The timeout, or better defined delay, depends on the command and instrument state. If you set a DMM to read values with 100ms aperture time, it will only answer after 100ms. If you set autozero on it will take twice as long. It's not easy, larger companies have dedicated test engineers who write and optimize these tests, and make test setups. A good engineer might be able to do the same test 100x faster, if the right budget is given in time and equipment.
eTobey:
That is the joy of programming. Sometimes you just have to try over and over again. But you could also write a program, that finds out, how much the delay has to be.
Writing a program to write a program.
I have some SCPI stuff in my "homepage" link on my profile.
Fungus:
--- Quote from: uliano on December 12, 2024, 12:57:44 pm ---when sending sequences of commands I had *more than occasional* "command failures" that could be eventually amended by inserting a long enough delay between commands.
--- End quote ---
Some commands need you to wait for completion. You can do this by sending "*WAI".
Chapter 2.3 of the Rigol DHO800 programming manual explains it.
(nb. the '*' commands are universal - should be the same on all devices).
uliano:
--- Quote from: Fungus on December 12, 2024, 01:58:31 pm ---
--- Quote from: uliano on December 12, 2024, 12:57:44 pm ---when sending sequences of commands I had *more than occasional* "command failures" that could be eventually amended by inserting a long enough delay between commands.
--- End quote ---
Some commands need you to wait for completion. You can do this by sending "*WAI".
--- End quote ---
it would have required SO LITTLE to implement that should have been made mandatory, unfortunately it's ignored by Siglent |O
Navigation
[0] Message Index
[#] Next page
Go to full version