Products > Test Equipment
SCPI best practices
uliano:
SDG 1000X, SDM3065X
from app notes:
def SocketQuery(Sock, cmd):
try:
Sock.sendall(cmd)
time.sleep(1)
except socket.error:
print('Send failed')
sys.exit()
reply = Sock.recv(4096)
return reply
def SocketSend(Sock, cmd):
try:
cmd = cmd + '\n'
Sock.sendall(cmd.encode('latin1'))
time.sleep(1)
except socket.error:
print('Send failed.')
sys.exit()
that 1s wait no matter what command you're issuing seems like overkill, to just set one parameter for example 0.1s or even less is enough.
so the alternatives are 2:
keep 1s and bloat the measurement time
or try to optimize by pausing a different time for different commands
if the semantic of "*OPC?" had been implemented as per manual description mentioned in the above post it would have been enough to follow each command by *OPC? thaw would have waited till the previous command was over and then only then returned 1
unfortunately it doesn't work like so, it seems that *OPC? is executed before completion of the previous command, in I queue many commands (eg. setting different paramenter) interleaved by *OPC? I observe tha only some parameter get changed if I don't insert some delay in between (and then *OPC? becomes completely useless)
uliano:
--- Quote from: HKJ on December 12, 2024, 08:47:27 pm ---Any command ending with a ? will send a answer back, other commands will not.
--- End quote ---
the problem is how to find a way to be sure that the command (without ?) has completed.
tszaboo:
--- Quote from: uliano on December 13, 2024, 08:39:00 am ---keep 1s and bloat the measurement time
or try to optimize by pausing a different time for different commands
--- End quote ---
You could use non-blocking receive. You check the receive buffer after a while and look for newline characters.
Same rules apply than an embedded systems communications. If you use the best practices from there you could make your setup faster.
If that's your goal. Sometimes it's just easier to get a cup of coffee while the test is running.
uliano:
The problem with SCPI, if I'm on the the right track, is that after a write of a command ()without "?") you don't get anything back not even a "\n".
and, here I'm guessing, if I send another command before the previous has completed it gets ignored or misinterpreted.
Rerouter:
It depends on the piece of equipment, when I was testing the limits of the SDS1204X-E, I believe the command buffer was 1MB before it started missing commands, so I could hit it with a few hundred commands and it would execute and reply in sequence, I don't recall anything being out of sequence, but i don't recall trying to use other commands why it ran a long capture or similar, things like reading out a channels voltage could be streamed at quite the rate.
(I was fuzzing the command interface for unknown commands)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version