908 Keysight InfiniiVision DSOX1204A/G Oscilloscopes Programmer's Guide
36 Programming Examples
myScope.WriteLine("*IDN?")
idn_string = myScope.ReadLine()
print "Identification string '%s'" % idn_string
# Clear status and load the default setup.
myScope.WriteLine("*CLS")
myScope.WriteLine("*RST")
# =========================================================
# Capture:
# =========================================================
def capture():
# Use auto-scale to automatically set up oscilloscope.
print "Autoscale."
myScope.WriteLine(":AUToscale")
# Set trigger mode.
myScope.WriteLine(":TRIGger:MODE EDGE")
myScope.WriteLine(":TRIGger:MODE?")
qresult = myScope.ReadLine()
print "Trigger mode: %s" % qresult
# Set EDGE trigger parameters.
myScope.WriteLine(":TRIGger:EDGE:SOURce CHANnel1")
myScope.WriteLine(":TRIGger:EDGE:SOURce?")
qresult = myScope.ReadLine()
print "Trigger edge source: %s" % qresult
myScope.WriteLine(":TRIGger:EDGE:LEVel 1.5")
myScope.WriteLine(":TRIGger:EDGE:LEVel?")
qresult = myScope.ReadLine()
print "Trigger edge level: %s" % qresult
myScope.WriteLine(":TRIGger:EDGE:SLOPe POSitive")
myScope.WriteLine(":TRIGger:EDGE:SLOPe?")
qresult = myScope.ReadLine()
print "Trigger edge slope: %s" % qresult
# Save oscilloscope setup to file.
myScope.WriteLine(":SYSTem:SETup?")
setup_bytes = myScope.ReadLineBinaryBlockOfByte()
File.WriteAllBytes("setup.stp", setup_bytes)
print "Setup bytes saved: %d" % len(setup_bytes)
# Change settings with individual commands:
# Set vertical scale and offset.
myScope.WriteLine(":CHANnel1:SCALe 0.05")
myScope.WriteLine(":CHANnel1:SCALe?")
qresult = myScope.ReadLine()
print "Channel 1 vertical scale: %s" % qresult
myScope.WriteLine(":CHANnel1:OFFSet -1.5")
myScope.WriteLine(":CHANnel1:OFFSet?")
qresult = myScope.ReadLine()