Synchronizing Acquisitions
38
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
1363
time.sleep(0.1)
# Pause 100 ms to prevent excessive queries
# This can actually be set a little faster, at 0.045.
The
# point here is that:
#
#
1.
If there are other things being controlled, going too
#
fast can tie up the bus.
#
2.
Going faster does not work on all scopes.
The
#
symptom of this not working is:
#
# The oscilloscope SHOULD trigger, but it sits there with the
# Single hard key on the oscilloscope lit yellow; pressing
# this key causes a trigger.
#
# The pause should be at the end of the loop, so that the
# oscilloscope is immediately asked if it is done.
#
# Loop exits when Acq_State != NOT_DONE, that is, it exits
# the loop when it is DONE or if the max wait time is
# exceeded.
if Acq_State == ACQ_DONE: # Acquisition fully completed
print "Signal acquired."
else: # Acquisition failed for some reason
print "Max wait time exceeded."
print "This happens if there was no trigger event."
print "Adjust settings accordingly.\n"
print "Properly closing oscilloscope connection and exiting " \
"script.\n"
KsInfiniiVisionX.clear() # Clear communications interface
KsInfiniiVisionX.query(":STOP;*OPC?")
# Stop the oscilloscope
KsInfiniiVisionX.close() # Close communications interface
sys.exit("Exiting script.")
# ====================================================================
# Do Something with data... save, export, additional analysis...
# ====================================================================
def do_something_with_data():
# For example, make a peak-peak voltage measurement on channel 1:
Vpp_Ch1 = \
str(KsInfiniiVisionX.query("MEASure:VPP? CHANnel1")).strip("\n")
# The result has a newline, so remove it with .strip("\n")
print "Vpp Ch1 = " + V " V\n"
# ====================================================================
# Main code
# ====================================================================
# Connect and initialize oscilloscope
# --------------------------------------------------------------------
# Define VISA Resource Manager & Install directory
rm = visa.ResourceManager('C:\\Windows\\System32\\agvisa32.dll')
# Define and open the oscilloscope using the VISA address