Synchronizing Acquisitions
38
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
1359
#
is NOT blocked (unless the front panel is otherwise locked by
#
":SYSTem:LOCK ON").
# ====================================================================
def blocking_method():
KsInfiniiVisionX.timeout =
SCOPE_ACQUISITION_TIME_OUT
# Time in milliseconds (PyVisa uses ms) to wait for the
# oscilloscope to arm, trigger, finish acquisition, and finish
# any processing.
#
# Note that this is a property of the device interface,
# KsInfiniiVisionX.
#
# If doing repeated acquisitions, this should be done BEFORE the
# loop, and changed again after the loop if the goal is to
# achieve the best throughput.
print("Acquiring signal(s)...")
# Set up a try/except block to catch a possible timeout and exit.
try:
KsInfiniiVisionX.query(":DIGitize;*OPC?")
# Acquire the signal(s) with :DIGItize (blocking) and wait
# until *OPC? comes back with a one.
print("Signal acquired.")
# Reset timeout back to what it was, GLOBAL_TOUT.
KsInfiniiVisionX.timeout =
GLOBAL_TOUT
# Catch a possible timeout and exit.
except Exception:
print "The acquisition timed out, most likely due to no " \
"trigger or improper setup causing no trigger. " \
"Properly closing the oscilloscope connection and " \
"exiting script.\n"
KsInfiniiVisionX.clear() # Clear communications interface;
# A device clear also aborts digitize.
KsInfiniiVisionX.close() # Close communications interface
sys.exit("Exiting script.")
# ====================================================================
# Define a function using the non-blocking :SINGle command and polling
# on the Operation Status Condition Register
# --------------------------------------------------------------------
#
# Benefits of this method:
#
#
-
Don't have to worry about interface timeouts.
#
-
Easy to expand to know when the oscilloscope is armed.
#
-
Don't have to worry about interface timeouts
#
-
Easy to expand to know when scope is armed, and triggered
#
-
MAY result in a higher sample rate than the blocking method
#
-
Always fills max available memory
#
-
Can use with a socket connection if desired
#
#
# Drawbacks of this method: