Scpi.net Example In Ironpython - Agilent Technologies InfiniiVision 3000 X-Series Programmer's Manual

Oscilloscopes
Hide thumbs Also See for InfiniiVision 3000 X-Series:
Table of Contents

Advertisement

40
Programming Examples
End Namespace

SCPI.NET Example in IronPython

You can also control Agilent oscilloscopes using the SCPI.NET library and
Python programming language on the .NET platform using:
• IronPython ("http://ironpython.codeplex.com/") which is an
To run this example with IronPython:
1
2
3
1260
Console.WriteLine("Waveform X increment: {0:e}", dblXincrement)
Console.WriteLine("Waveform X origin: {0:e}", dblXorigin)
Console.WriteLine("Waveform X reference: {0:e}", nXreference)
Console.WriteLine("Waveform Y increment: {0:e}", dblYincrement)
Console.WriteLine("Waveform Y origin: {0:e}", dblYorigin)
Console.WriteLine("Waveform Y reference: {0:e}", nYreference)
' Read waveform data.
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}", _
dblXorigin + (CSng(i) * dblXincrement), _
((CSng(byteResultsArray(i)) - nYreference) * _
dblYincrement) + dblYorigin)
Next
' Close output file.
writer.Close()
Console.WriteLine("Waveform format BYTE data written to {0}", _
End Sub
End Class
implementation of the Python programming language running under
.NET.
Install the Agilent Command Expert software and the command set for
the oscilloscope.
Cut- and- paste the code that follows into a file named "example.py".
Edit the program to use the address of your oscilloscope.
Agilent InfiniiVision 3000 X-Series Oscilloscopes Programmer's Guide
strPath)

Advertisement

Table of Contents
loading

Table of Contents