1500
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
40
Programming Examples
) = scope.SCPI.WAVeform.PREamble.Query()
print "Waveform format: %s" % wav_form_dict[int(wav_form)]
print "Acquire type: %s" % acq_type_dict[int(acq_type)]
print "Waveform points desired: %s" % wfmpts
print "Waveform average count: %s" % avgcnt
print "Waveform X increment: %s" % x_increment
print "Waveform X origin: %s" % x_origin
print "Waveform X reference: %s" % x_reference
# Always 0.
print "Waveform Y increment: %s" % y_increment
print "Waveform Y origin: %s" % y_origin
print "Waveform Y reference: %s" % y_reference
# Get numeric values for later calculations.
x_increment = scope.SCPI.WAVeform.XINCrement.Query()
x_origin = scope.SCPI.WAVeform.XORigin.Query()
y_increment = scope.SCPI.WAVeform.YINCrement.Query()
y_origin = scope.SCPI.WAVeform.YORigin.Query()
y_reference = scope.SCPI.WAVeform.YREFerence.Query()
# Get the waveform data.
data_bytes = scope.SCPI.WAVeform.DATA.QueryBYTE()
nLength = len(data_bytes)
print "Number of data values: %d" % nLength
# Open file for output.
strPath = "waveform_data.csv"
writer = File.CreateText(strPath)
# Output waveform data in CSV format.
for i in xrange(0, nLength - 1):
time_val = x_ i * x_increment
voltage = (data_bytes[i] - y_reference) * y_inc y_origin
writer.WriteLine("%E, %f" % (time_val, voltage))
# Close output file.
writer.Close()
print "Waveform format BYTE data written to %s." % strPath
# =========================================================
# Main program:
# =========================================================
addr = "TCPIP0::10.112.94.136::hislip9-0.0::INSTR"
scope = AgInfiniiVision4000X(addr)
scope.Transport.DefaultTimeout.Set(10000)
# Initialize the oscilloscope, capture data, and analyze.
initialize()
capture()
analyze()
print "End of program."
# Wait for a key press before exiting.
print "Press any key to exit..."
Console.ReadKey(True)