# ====================================================================
# Do Something with data... save, export, additional analysis...
# ====================================================================
def do_something_with_data():
# ====================================================================
# 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
Keysight InfiniiVision 4000 X-Series Oscilloscopes Programmer's Guide
time.sleep(0.1)
# This can actually be set a little faster, at 0.045.
# 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.
#
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.")
# 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 = " + Vpp_Ch1 + " V\n"
# Pause 100 ms to prevent excessive queries
Synchronizing Acquisitions
The
The
1605
42
Need help?
Do you have a question about the InfiniiVision 4000 X Series and is the answer not in the manual?