1254 Agilent InfiniiVision 3000 X-Series Oscilloscopes Programmer's Guide
40 Programming Examples
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(inti=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);
}
}
}
SCPI.NET Example in Visual Basic .NET
To compile and run this example in Microsoft Visual Studio 2008:
1 Install the Agilent Command Expert software and the command set for
the oscilloscope.
2 Open Visual Studio.
3 Create a new Visual Basic, Windows, Console Application project.