904 Keysight InfiniiVision DSOX1204A/G Oscilloscopes Programmer's Guide
36 Programming Examples
' Set the acquisition type (NORMal, PEAK, AVERage, or HRESolution)
.
myScope.WriteLine(":ACQuire:TYPE NORMal")
myScope.WriteLine(":ACQuire:TYPE?")
strResults = myScope.ReadLine()
Console.WriteLine("Acquire type: {0}", strResults)
' Or, configure by loading a previously saved setup.
Dim DataArray As Byte()
Dim nBytesWritten As Integer
' Read setup string from file.
strPath = "c:\scope\config\setup.stp"
DataArray = File.ReadAllBytes(strPath)
nBytesWritten = DataArray.Length
' Restore setup string.
myScope.Write(":SYSTem:SETup ")
myScope.WriteBinary(DataArray)
myScope.WriteLine("")
Console.WriteLine("Setup bytes restored: {0}", nBytesWritten)
' Capture an acquisition using :DIGitize.
myScope.WriteLine(":DIGitize CHANnel1")
' Analyze the captured waveform.
' ==============================================================
' Make a couple of measurements.
' -----------------------------------------------------------
myScope.WriteLine(":MEASure:SOURce CHANnel1")
myScope.WriteLine(":MEASure:SOURce?")
strResults = myScope.ReadLine()
Console.WriteLine("Measure source: {0}", strResults)
Dim fResult As Double
myScope.WriteLine(":MEASure:FREQuency")
myScope.WriteLine(":MEASure:FREQuency?")
fResult = myScope.ReadLineDouble()
Console.WriteLine("Frequency: {0:F4} kHz", fResult / 1000)
myScope.WriteLine(":MEASure:VAMPlitude")
myScope.WriteLine(":MEASure:VAMPlitude?")
fResult = myScope.ReadLineDouble()
Console.WriteLine("Vertical amplitude: {0:F2} V", fResult)
' Download the screen image.
' -----------------------------------------------------------
myScope.WriteLine(":HARDcopy:INKSaver OFF")
' Get the screen data.
myScope.WriteLine(":DISPlay:DATA? PNG, COLor")
ResultsArray = myScope.ReadLineBinaryBlockOfByte()
nLength = ResultsArray.Length
' Store the screen data to a file.
strPath = "c:\scope\data\screen.png"