Agilent Technologies InfiniiVision 2000 X-Series Programmer's Manual page 878

Oscilloscopes
Hide thumbs Also See for InfiniiVision 2000 X-Series:
Table of Contents

Advertisement

38
Programming Examples
# =========================================================
# Send a query, check for errors, return values:
# =========================================================
def do_query_values(query):
if debug:
results = InfiniiVision.ask_for_values("%s\n" % query)
check_instrument_errors(query)
return results
# =========================================================
# Check for instrument errors:
# =========================================================
def check_instrument_errors(command):
while True:
nd
# =========================================================
# Returns data from definite-length block.
# =========================================================
def get_definite_length_block_data(sBlock):
# First character should be "#".
pound = sBlock[0:1]
if pound != "#":
und
# 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:]
878
print "Qyv = '%s'" % query
error_string = InfiniiVision.ask(":SYSTem:ERRor?\n")
if error_string:
# If there is an error string value.
if error_string.find("+0,", 0, 3) == -1:
print "ERROR: %s, command: '%s'" % (error_string, command)
print "Exited because of error."
sys.exit(1)
else:
# "No error"
break
else:
# :SYSTem:ERRor? should always return string.
print "ERROR: :SYSTem:ERRor? returned nothing, command: '%s'" % comma
print "Exited because of error."
sys.exit(1)
print "PROBLEM: Invalid binary block format, pound char is '%s'." % po
print "Exited because of problem."
sys.exit(1)
Agilent InfiniiVision 2000 X-Series Oscilloscopes Programmer's Guide
# Not "No error".

Advertisement

Table of Contents
loading

Table of Contents