898 Keysight InfiniiVision DSOX1204A/G Oscilloscopes Programmer's Guide
36 Programming Examples
// -----------------------------------------------------------
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";
fStream = File.Open(strPath, FileMode.Create);
fStream.Write(ResultsArray, 0, nLength);
fStream.Close();
Console.WriteLine("Screen image ({0} bytes) written to {1}",
nLength, strPath);
// Download waveform data.
// -----------------------------------------------------------
// Set the waveform points mode.
myScope.WriteLine(":WAVeform:POINts:MODE RAW");
myScope.WriteLine(":WAVeform:POINts:MODE?");
strResults = myScope.ReadLine();
Console.WriteLine("Waveform points mode: {0}", strResults);
// Get the number of waveform points available.
myScope.WriteLine(":WAVeform:POINts?");
strResults = myScope.ReadLine();
Console.WriteLine("Waveform points available: {0}", strResults);
// Set the waveform source.
myScope.WriteLine(":WAVeform:SOURce CHANnel1");
myScope.WriteLine(":WAVeform:SOURce?");
strResults = myScope.ReadLine();
Console.WriteLine("Waveform source: {0}", strResults);
// Choose the format of the data returned (WORD, BYTE, ASCII):
myScope.WriteLine(":WAVeform:FORMat BYTE");
myScope.WriteLine(":WAVeform:FORMat?");
strResults = myScope.ReadLine();
Console.WriteLine("Waveform format: {0}", strResults);
// Display the waveform settings:
double[] fResultsArray;
myScope.WriteLine(":WAVeform:PREamble?");
fResultsArray = myScope.ReadLineListOfDouble();
double fFormat = fResultsArray[0];
if (fFormat == 0.0)
{
Console.WriteLine("Waveform format: BYTE");
}
else if (fFormat == 1.0)
{
Console.WriteLine("Waveform format: WORD");
}
else if (fFormat == 2.0)