900 Keysight InfiniiVision DSOX1204A/G Oscilloscopes Programmer's Guide
36 Programming Examples
StreamWriter writer = File.CreateText(strPath);
// Output waveform data in CSV format.
for(inti=0;i<nLength - 1; i++)
writer.WriteLine("{0:f9}, {1:f6}",
fXorigin + ((float)i * fXincrement),
(((float)ResultsArray[i] - fYreference)
* fYincrement) + fYorigin);
// Close output file.
writer.Close();
Console.WriteLine("Waveform format BYTE data written to {0}",
strPath);
// Close the connection to the instrument
// --------------------------------------------------------------
session.Dispose();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
VISA.NET Example in Visual Basic .NET
To compile and run this example in Microsoft Visual Studio 2013:
1 Open Visual Studio.
2 Choose FILE > New > Project....
3 In the New Project dialog box, select .NET Framework 4.5.2.
4 Create a new Visual Basic, Console Application project.
5 Cut-and-paste the code that follows into the Visual Basic .NET source file.
6 Edit the program to use the VISA address of your oscilloscope.
7 Add a reference to the VISA.NET 3.0 driver:
a Right-click the project you wish to modify (not the solution) in the Solution
Explorer window of the Microsoft Visual Studio environment.
b Choose Add Reference....
c In the Add Reference dialog, select the Browse tab, and navigate to the
ScpiNetDrivers folder.
• Windows XP: C:\Documents and Settings\All Users\Agilent\Command
Expert\ScpiNetDrivers