VB.net:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' EXAMPLE DESCRIPTION:
'
' Sync_Arbs is a sample program that demonstrates how to call arbitrary waveforms and synchronize them together:
'
' Wave Shape: SINC.arb
' Period: 10 usec
' Amplitude: 2 Volt Peak to Peak
' Offset: 0 Volt
' Output Impedance: 50 Ohm
' Channel1 Output: Enabled
' Channel2 Output: Enabled
'
' Caution: All un-saved data present in volatile memory will be erased.
' Save information before proceeding to this example program.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' BUILDING THIS EXAMPLE:
'
' This sample program is intended to be used with Microsoft Visual C# 2005,
' or later, and the VISA COM library.
'
' Sample program execution requires the VISA COM library as a prerequisite,
' which is installed by the Agilent IO Libraries Suite.
' Sample program uses VISA COM 3.0 Type Library as a reference to the
' VISA COM library:
'
' $(VXIPNPPATH)\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright © 2012 Agilent Technologies Inc. All rights
' reserved.
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Agilent has no
' warranty, obligations or liability for any Sample Application Files.
'
' Agilent Technologies provides programming examples for illustration only,
' This sample program assumes that you are familiar with the programming
' language being demonstrated and the tools used to create and debug
' procedures. Agilent support engineers can help explain the
' functionality of Agilent software components and associated
' commands, but they will not modify these samples to provide added
' functionality or construct procedures to meet your specific needs.
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Imports System.Text
'Add VISA COM library reference.
Imports Ivi.Visa.Interop
Module Module1
Const noErrString As String = "+0,""No error""" + vbLf
Sub Main()
Try
SyncArbs()
Catch oExp As Exception
Console.WriteLine(oExp.Message)
End Try
Console.WriteLine("Press [Enter] to exit")
Console.ReadLine()
End Sub
Sub SyncArbs()
Dim instAddress As String = "TCPIP0::156.140.113.206::inst0::INSTR"
Dim oRm As New ResourceManagerClass()
Dim oFio As New FormattedIO488Class()
'Open session for instrument.
oFio.IO = oRm.Open(instAddress, AccessMode.NO_LOCK, 2000, "")
oFio.IO.Timeout = 10000
'Query Idendity string and report.
oFio.WriteString("*IDN?", True)
Dim strResult As String = oFio.ReadString()
Console.WriteLine("Instrument Identity String: " + strResult)
'Clear and reset instrument
oFio.WriteString("*CLS;*RST;*OPC?", True)
oFio.ReadString()
'Clear volatile memory on channel 1
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", True)
'Load and configure arb for channel 1
oFio.WriteString("MMEM:LOAD:DATA1 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", True) ' wait for operations to complete before moving on
oFio.WriteString("SOURce1:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
oFio.WriteString("SOURce1:FUNCtion ARB", True) ' turn on the arbitrary waveform
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
oFio.WriteString("SOURCE1:VOLT 2", True) ' set the max voltage to 2VPP
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", True) ' set the offset to 0VDC
oFio.WriteString("OUTPUT1:LOAD 50", True) ' set the output load to 50 ohms
'Clear volatile memory on channel 2
oFio.WriteString("SOURce2:DATA:VOLatile:CLEar", True)
'Load and configure arb for channel 2
oFio.WriteString("MMEM:LOAD:DATA2 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", True) ' wait for operations to complete before moving on
oFio.WriteString("SOURce2:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
oFio.WriteString("SOURce2:FUNCtion ARB", True) ' turn on the arbitrary waveform
oFio.WriteString("SOURCE2:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
oFio.WriteString("SOURCE2:VOLT 2", True) ' set the max voltage to 2VPP
oFio.WriteString("SOURCE2:VOLT:OFFSET 0", True) ' set the offset to 0VDC
oFio.WriteString("OUTPUT2:LOAD 50", True) ' set the output load to 50 ohms
'Enable outputs.
oFio.WriteString("OUTPUT1 ON", True)
oFio.WriteString("OUTPUT2 ON", True)
'Synchronize the arb waveforms
oFio.WriteString("FUNC:ARB:SYNC", True)
'Read Errors
oFio.WriteString("SYSTEM:ERROR?", True)
strResult = oFio.ReadString()
If strResult = noErrString Then
Console.WriteLine("Output set without any error" + vbLf)
Else
Console.WriteLine("Error reported: " + strResult)
End If
End Sub
End Module
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' EXAMPLE DESCRIPTION:
'
' Sync_Arbs is a sample program that demonstrates how to call arbitrary waveforms and synchronize them together:
'
' Wave Shape: SINC.arb
' Period: 10 usec
' Amplitude: 2 Volt Peak to Peak
' Offset: 0 Volt
' Output Impedance: 50 Ohm
' Channel1 Output: Enabled
' Channel2 Output: Enabled
'
' Caution: All un-saved data present in volatile memory will be erased.
' Save information before proceeding to this example program.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' BUILDING THIS EXAMPLE:
'
' This sample program is intended to be used with Microsoft Visual C# 2005,
' or later, and the VISA COM library.
'
' Sample program execution requires the VISA COM library as a prerequisite,
' which is installed by the Agilent IO Libraries Suite.
' Sample program uses VISA COM 3.0 Type Library as a reference to the
' VISA COM library:
'
' $(VXIPNPPATH)\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright © 2012 Agilent Technologies Inc. All rights
' reserved.
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Agilent has no
' warranty, obligations or liability for any Sample Application Files.
'
' Agilent Technologies provides programming examples for illustration only,
' This sample program assumes that you are familiar with the programming
' language being demonstrated and the tools used to create and debug
' procedures. Agilent support engineers can help explain the
' functionality of Agilent software components and associated
' commands, but they will not modify these samples to provide added
' functionality or construct procedures to meet your specific needs.
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Imports System.Text
'Add VISA COM library reference.
Imports Ivi.Visa.Interop
Module Module1
Const noErrString As String = "+0,""No error""" + vbLf
Sub Main()
Try
SyncArbs()
Catch oExp As Exception
Console.WriteLine(oExp.Message)
End Try
Console.WriteLine("Press [Enter] to exit")
Console.ReadLine()
End Sub
Sub SyncArbs()
Dim instAddress As String = "TCPIP0::156.140.113.206::inst0::INSTR"
Dim oRm As New ResourceManagerClass()
Dim oFio As New FormattedIO488Class()
'Open session for instrument.
oFio.IO = oRm.Open(instAddress, AccessMode.NO_LOCK, 2000, "")
oFio.IO.Timeout = 10000
'Query Idendity string and report.
oFio.WriteString("*IDN?", True)
Dim strResult As String = oFio.ReadString()
Console.WriteLine("Instrument Identity String: " + strResult)
'Clear and reset instrument
oFio.WriteString("*CLS;*RST;*OPC?", True)
oFio.ReadString()
'Clear volatile memory on channel 1
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", True)
'Load and configure arb for channel 1
oFio.WriteString("MMEM:LOAD:DATA1 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", True) ' wait for operations to complete before moving on
oFio.WriteString("SOURce1:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
oFio.WriteString("SOURce1:FUNCtion ARB", True) ' turn on the arbitrary waveform
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
oFio.WriteString("SOURCE1:VOLT 2", True) ' set the max voltage to 2VPP
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", True) ' set the offset to 0VDC
oFio.WriteString("OUTPUT1:LOAD 50", True) ' set the output load to 50 ohms
'Clear volatile memory on channel 2
oFio.WriteString("SOURce2:DATA:VOLatile:CLEar", True)
'Load and configure arb for channel 2
oFio.WriteString("MMEM:LOAD:DATA2 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", True) ' wait for operations to complete before moving on
oFio.WriteString("SOURce2:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
oFio.WriteString("SOURce2:FUNCtion ARB", True) ' turn on the arbitrary waveform
oFio.WriteString("SOURCE2:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
oFio.WriteString("SOURCE2:VOLT 2", True) ' set the max voltage to 2VPP
oFio.WriteString("SOURCE2:VOLT:OFFSET 0", True) ' set the offset to 0VDC
oFio.WriteString("OUTPUT2:LOAD 50", True) ' set the output load to 50 ohms
'Enable outputs.
oFio.WriteString("OUTPUT1 ON", True)
oFio.WriteString("OUTPUT2 ON", True)
'Synchronize the arb waveforms
oFio.WriteString("FUNC:ARB:SYNC", True)
'Read Errors
oFio.WriteString("SYSTEM:ERROR?", True)
strResult = oFio.ReadString()
If strResult = noErrString Then
Console.WriteLine("Output set without any error" + vbLf)
Else
Console.WriteLine("Error reported: " + strResult)
End If
End Sub
End Module
/****************************************************************************
*
* EXAMPLE DESCRIPTION:
*
* Sync_Arbs is a sample program that demonstrates how to call arbitrary waveforms and synchronize them together:
*
* Wave Shape: SINC.arb
* Period: 10 usec
* Amplitude: 2 Volt Peak to Peak
* Offset: 0 Volt
* Output Impedance: 50 Ohm
* Channel1 Output: Enabled
* Channel2 Output: Enabled
*
*
* Caution: All un-saved data present in volatile memory will be erased.
* Save information before proceeding to this example program.
*
******************************************************************************
*
* BUILDING THIS EXAMPLE:
*
* This sample program is intended to be used with Microsoft Visual C# 2005,
* or later, and the VISA COM library.
*
* Sample program execution requires the VISA COM library as a prerequisite,
* which is installed by the Agilent IO Libraries Suite.
* Sample program uses VISA COM 3.0 Type Library as a reference to the
* VISA COM library:
*
* $(VXIPNPPATH)\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
*
******************************************************************************
*
* Copyright © 2012 Agilent Technologies Inc. All rights
* reserved.
*
* You have a royalty-free right to use, modify, reproduce and distribute
* the Sample Application Files (and/or any modified version) in any way
* you find useful, provided that you agree that Agilent has no
* warranty, obligations or liability for any Sample Application Files.
*
* Agilent Technologies provides programming examples for illustration only,
* This sample program assumes that you are familiar with the programming
* language being demonstrated and the tools used to create and debug
* procedures. Agilent support engineers can help explain the
* functionality of Agilent software components and associated
* commands, but they will not modify these samples to provide added
* functionality or construct procedures to meet your specific needs.
*
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
//Add VISA COM library reference.
using Ivi.Visa.Interop;
namespace Sync_Arbs
{
class Program
{
const string noErrString = "+0,\"No error\"\n";
static void Main(string[] args)
{
try
{
SyncArbs();
}
catch (Exception oExp)
{
Console.WriteLine(oExp.Message);
}
Console.WriteLine("Press [Enter] to exit");
Console.ReadKey();
}
public static void SyncArbs()
{
const int NUM_DATA_POINTS = 100000;
float[] z = new float[NUM_DATA_POINTS];
string instAddress = "TCPIP0::156.140.113.206::inst0::INSTR";
ResourceManagerClass oRm = new ResourceManagerClass();
FormattedIO488Class oFio = new FormattedIO488Class();
//Open session for instrument.
oFio.IO = (IMessage)oRm.Open(instAddress, AccessMode.NO_LOCK, 2000, "");
oFio.IO.Timeout = 10000;
//Query Idendity string and report.
oFio.WriteString("*IDN?", true);
string strResult = oFio.ReadString();
Console.WriteLine("Instrument Identity String: " + strResult);
//Clear and reset instrument
oFio.WriteString("*CLS;*RST;*OPC?", true);
oFio.ReadString();
//Clear volatile memory on channel 1
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", true);
//Load and configure arb for channel 1
oFio.WriteString("MMEM:LOAD:DATA1 \"INT:\\BUILTIN\\SINC.ARB\"", true); // Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", true); // wait for operations to complete before moving on
oFio.WriteString("SOURce1:FUNCtion:ARB \"INT:\\BUILTIN\\SINC.ARB\"", true); // Make Sinc.arb the active arb
oFio.WriteString("SOURce1:FUNCtion ARB", true); // turn on the arbitrary waveform
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 10E-6", true); // set the period to 10uS
oFio.WriteString("SOURCE1:VOLT 2", true); // set the max voltage to 2VPP
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", true); // set the offset to 0VDC
oFio.WriteString("OUTPUT1:LOAD 50", true); // set the output load to 50 ohms
//Clear volatile memory on channel 2
oFio.WriteString("SOURce2:DATA:VOLatile:CLEar", true);
//Load and configure arb for channel 2
oFio.WriteString("MMEM:LOAD:DATA2 \"INT:\\BUILTIN\\SINC.ARB\"", true); // Load SINC.ARB into volatile memory
oFio.WriteString("*WAI", true); // wait for operations to complete before moving on
oFio.WriteString("SOURce2:FUNCtion:ARB \"INT:\\BUILTIN\\SINC.ARB\"", true); // Make Sinc.arb the active arb
oFio.WriteString("SOURce2:FUNCtion ARB", true); // turn on the arbitrary waveform
oFio.WriteString("SOURCE2:FUNCtion:ARB:PER 10E-6", true); // set the period to 10uS
oFio.WriteString("SOURCE2:VOLT 2", true); // set the max voltage to 2VPP
oFio.WriteString("SOURCE2:VOLT:OFFSET 0", true); // set the offset to 0VDC
oFio.WriteString("OUTPUT2:LOAD 50", true); // set the output load to 50 ohms
//Enable outputs.
oFio.WriteString("OUTPUT1 ON", true);
oFio.WriteString("OUTPUT2 ON", true);
//Synchronize the arb waveforms
oFio.WriteString("FUNC:ARB:SYNC\n", true);
//Read Error/s
oFio.WriteString("SYSTEM:ERROR?", true);
strResult = oFio.ReadString();
if (strResult == noErrString)
{
Console.WriteLine("Output set without any error\n");
}
else
{
Console.WriteLine("Error reported: " + strResult);
}
}
}
}