Scpi.net Example In Visual Basic .Net - Agilent Technologies InfiniiVision 3000 Programmer's Manual

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

Advertisement

39
Programming Examples
}

SCPI.NET Example in Visual Basic .NET

To compile and run this example in Microsoft Visual Studio 2008:
1
2
3
1204
else if (nType == 2)
{
Console.WriteLine("Acquire type: AVERage");
}
else if (nType == 3)
{
Console.WriteLine("Acquire type: HRESolution");
}
Console.WriteLine("Waveform points: {0:e}", nPoints);
Console.WriteLine("Waveform average count: {0:e}", nCount);
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(out 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)) File.Delete(strPath);
// Open file for output.
StreamWriter writer = File.CreateText(strPath);
// Output waveform data in CSV format.
for (int i = 0; i < nLength - 1; i++)
writer.WriteLine("{0:f9}, {1:f6}",
dblXorigin + ((float)i * dblXincrement),
(((float)byteResultsArray[i] - nYreference)
* dblYincrement) + dblYorigin);
// Close output file.
writer.Close();
Console.WriteLine("Waveform format BYTE data written to {0}",
strPath);
}
}
Install the Agilent Command Expert software and the command set for
the oscilloscope.
Open Visual Studio.
Create a new Visual Basic, Windows, Console Application project.
Agilent InfiniiVision 3000 X-Series Oscilloscopes Programmer's Guide

Advertisement

Table of Contents
loading

Table of Contents