1340
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
37
Status Reporting
# Test for armed.
ARMED_STATUS = int(KsInfiniiVisionX.query(":AER?"))
# Wait indefinitely until armed.
while ARMED_STATUS != ARMED:
# Check the status again after small delay.
time.sleep(0.1)
# 100 ms delay to prevent excessive queries.
ARMED_STATUS = int(KsInfiniiVisionX.query(":AER?"))
print "Oscilloscope is armed (method 1, using :AER? query)!"
print "It took " + str(time.clock() - now) +\
" seconds to arm.\n"
# ====================================================================
# Method 2: Read the Status Byte
# --------------------------------------------------------------------
# This method reads the Status Byte register's OPER bit (bit 7) using
# the "read status byte" function in VISA, which works during blocking
# commands and can therefore be used with the :DIGitize command.
#
# The Status Byte bits do NOT go low (0) when the register is read.
#
# The *CLS command will clear the Status Byte bits.
#
# CAUTION: The oscilloscope's status registers are not updated until
# the :DIGitize completes.
So, while the ARM may go true midway
# through the :DIGitize, it does not get reported to the status model
# until the :DIGitize completes, and therefore the STB does not
# reflect it as true until the :DIGitize completes.
# ====================================================================
def method_2():
# Stop the oscilloscope.
KsInfiniiVisionX.query(":STOP;*OPC?")
# Method 2: Initiate capture using :DIGitize or :SINGle
# ----------------------------------------------------------------
print "Acquiring signal (Method 2, using :DIGitize)...\n"
now = time.clock()
# Clear all status registers before checking for new events.
KsInfiniiVisionX.write("*CLS")
# Mask out all bits in the Operation Status Event Register except
# for the ARM bit.
KsInfiniiVisionX.write(":OPEE 32")
# "Unmask" only the arm bit
# Use the :DIGitize command to start the acquisition.
KsInfiniiVisionX.write(":DIGitize")
# Method 2: Determine if armed by reading the Status Byte.
# ----------------------------------------------------------------
# Define register bit masks for the Status Byte Register
ARM_BIT = 7
# 1 leftshift 7 = 128 (bit 7 in the Status Byte Register)