1496
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
40
Programming Examples
myScope.SCPI.WAVeform.DATA.QueryBYTE(byteResultsArray)
nLength = byteResultsArray.Length
Console.WriteLine("Number of data values: {0}", nLength)
' Set up output file:
strPath = "c:\scope\data\waveform_data.csv"
If File.Exists(strPath) Then
File.Delete(strPath)
End If
' Open file for output.
Dim writer As StreamWriter = File.CreateText(strPath)
' Output waveform data in CSV format.
For i As Integer = 0 To nLength - 2
writer.WriteLine("{0:f9}, {1:f6}", _
dblX (CSng(i) * dblXincrement), _
((CSng(byteResultsArray(i)) - nYreference) * _
dblYincrement) + dblYorigin)
Next
' Close output file.
writer.Close()
Console.WriteLine("Waveform format BYTE data written to {0}", _
strPath)
End Sub
End Class
End Namespace
SCPI.NET Example in IronPython
You can also control Keysight oscilloscopes using the SCPI.NET library and Python
programming language on the .NET platform using:
• IronPython (
http://ironpython.codeplex.com/
) which is an implementation of
the Python programming language running under .NET.
To run this example with IronPython:
1
Install the Keysight Command Expert software and the command set for the
oscilloscope.
2
Cut-and-paste the code that follows into a file named "example.py".
3
Edit the program to use the address of your oscilloscope.
4
If the IronPython "ipy.exe" can be found via your PATH environment variable,
open a Command Prompt window; then, change to the folder that contains the
"example.py" file, and enter:
ipy example.py
#
# Keysight SCPI.NET Example in IronPython
# *********************************************************
# This program illustrates a few commonly used programming
# features of your Keysight oscilloscope.