User manual

Table Of Contents
Part 2: Automation Programming Reference
Automation in C#
Newer programming languages like C# are not supported by the ActiveDSO control or the VICP protocol.
We recommend that those writing Automation programs in C# should do the following:
l Connect to the oscilloscope over ENET, either through your LAN or a direct connection.
l On the oscilloscope, choose the LXI (VXI-11) remote control setting.
l On the controller, install an VISA-compliant driver and the IVI C# VISA API to decouple your
Automation program from the driver.
The following C# program uses the above configuration to make a remote connection to the oscilloscope
and perform the same tasks as the Python script in Program Using VISA.
Note: Characters in angle brackets are placeholders. Omit the brackets from your code.
using System;
using Ivi.Visa;
namespace LeCroy.ScopeVisaExample
{
public class ScopeExample
{
public void DoExample()
{
// Open session to scope
var session = (IMessageBasedSession)GlobalResourceManager.Open
("TCPIP0::<hostname|IP address>::INSTR");
session.TimeoutMilliseconds = 5000;
session.Clear();
// Don't return command header with query result
session.FormattedIO.WriteLine("COMM_HEADER OFF");
// Recall default setup
session.FormattedIO.WriteLine("vbs 'app.settodefaultsetup'");
// Wait until scope is done with recall default
session.FormattedIO.WriteLine("vbs? 'return=app.WaitUntilIdle(5)'");
session.FormattedIO.ReadString();
// Set up acquisition trigger and timebase
session.FormattedIO.WriteLine("vbs 'app.acquisition.triggermode =
\"stopped\"'");
session.FormattedIO.WriteLine("vbs 'app.acquisition.trigger.edge.level =
1.0'");
session.FormattedIO.WriteLine("vbs 'app.acquisition.triggermode =
\"Single\"'");
session.FormattedIO.WriteLine("vbs 'app.acquisition.horizontal.maximize =
\"FixedSampleRate\"'");
2-53