Technical data
1028 Agilent Infiniium 90000 Series Oscilloscopes Programmer's Reference
35 Sample Programs
while True:
error_string = Infiniium.ask(":SYSTem:ERRor? STRing\n")
if error_string: # If there is an error string value.
if error_string.find("0,", 0, 2) == -1: # Not "No error".
print "ERROR: %s, command: '%s'" % (error_string, command)
print "Exited because of error."
sys.exit(1)
else: # "No error"
break
else: # :SYSTem:ERRor? STRing should always return string.
print "ERROR: :SYSTem:ERRor? STRing returned nothing, command: '%s'"
% command
print "Exited because of error."
sys.exit(1)
# =========================================================
# Returns data from definite-length block.
# =========================================================
def get_definite_length_block_data(sBlock):
# First character should be "#".
pound = sBlock[0:1]
if pound != "#":
print "PROBLEM: Invalid binary block format, pound char is '%s'." % po
und
print "Exited because of problem."
sys.exit(1)
# Second character is number of following digits for length value.
digits = sBlock[1:2]
# Get the data out of the block and return it.
sData = sBlock[int(digits) + 2:]
return sData
# =========================================================
# Main program:
# =========================================================
Infiniium = visa.instrument("TCPIP0::130.29.71.191::inst0::INSTR")
Infiniium.timeout = 15
Infiniium.term_chars = ""
Infiniium.clear()
initialize()
capture()
analyze()