For this example you must have a 33500B with the IQ option installed, this will not run on the 33522A.
VB.net:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' EXAMPLE DESCRIPTION:
'
' ASCII_IQ_ARB is a sample program that demonstrates how to download an IQ arbitrary waveform
' into instrument volatile memory and play back the same with the configuration below:
' This arb generates a 4000 point pulse waveform on both channels, of which the first 200 points define a
' positive pulse from 0 volts to the maximum defined voltage amplitude.
'
' Wave Shape: Arb
' Amplitude: 2 Volt Peak to Peak
' Offset: 0 Volt
' Output Impedance: 50 Ohm
' Channel1 and 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
AsciiIQArb()
Catch oExp As Exception
Console.WriteLine(oExp.Message)
End Try
Console.WriteLine("Press [Enter] to exit")
Console.ReadLine()
End Sub
Sub AsciiIQArb()
Dim strDataCommand As New StringBuilder()
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
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", True)
' Create IQ arb waveform named "TestArb" with 4000 points of 0-1 data
strDataCommand.Append("SOURce1:DATA:ARB2 TestArb")
' Specify IQ arb format
oFio.WriteString("DATA:ARB2:FORMAT AABB", True)
'Generating waveforms
'I
For I As Double = 1 To 5 ' Set rise time (5 points)
strDataCommand.Append("," + ((I - 1) / 5).ToString())
Next I
For I As Double = 6 To 205 ' Set pulse width (200 points)
strDataCommand.Append(",1")
Next I
For I As Double = 206 To 210 ' Set fall time (5 points)
strDataCommand.Append("," + ((210 - I) / 5).ToString())
Next I
For I As Double = 211 To 4000 ' Set remaining points to zero
strDataCommand.Append(",0")
Next I
'Q
For I As Double = 1 To 5 ' Set rise time (5 points)
strDataCommand.Append("," + ((I - 1) / 5).ToString())
Next I
For I As Double = 6 To 205 ' Set pulse width (200 points)
strDataCommand.Append(",1")
Next I
For I As Double = 206 To 210 ' Set fall time (5 points)
strDataCommand.Append("," + ((210 - I) / 5).ToString())
Next I
For I As Double = 211 To 4000 ' Set remaining points to zero
strDataCommand.Append(",0")
Next I
'Downloading waveform
Console.WriteLine("Downloading Waveform...")
oFio.WriteString(strDataCommand.ToString(), True)
oFio.WriteString("*OPC?", True)
oFio.ReadString()
Console.WriteLine("Download Complete\n")
'Set desired configuration
oFio.WriteString("SOURce1:FUNCtion ARB", True) ' turn on arb function
oFio.WriteString("SOURce1:FUNCtion:ARBitrary TestArb", True) ' set current arb waveform to defined arb pulse
oFio.WriteString("SOURCE1:VOLT 2", True) ' set max waveform amplitude to 2 Vpp
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", True) ' set offset to 0 V
oFio.WriteString("OUTPUT1:LOAD 50", True) ' set output load to 50 ohms
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 100E-6", True) ' set waveform period to 100uS
'Enable Output
oFio.WriteString("OUTPUT1 ON", True) ' turn on channel 1 output
'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
VB.net:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' EXAMPLE DESCRIPTION:
'
' ASCII_IQ_ARB is a sample program that demonstrates how to download an IQ arbitrary waveform
' into instrument volatile memory and play back the same with the configuration below:
' This arb generates a 4000 point pulse waveform on both channels, of which the first 200 points define a
' positive pulse from 0 volts to the maximum defined voltage amplitude.
'
' Wave Shape: Arb
' Amplitude: 2 Volt Peak to Peak
' Offset: 0 Volt
' Output Impedance: 50 Ohm
' Channel1 and 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
AsciiIQArb()
Catch oExp As Exception
Console.WriteLine(oExp.Message)
End Try
Console.WriteLine("Press [Enter] to exit")
Console.ReadLine()
End Sub
Sub AsciiIQArb()
Dim strDataCommand As New StringBuilder()
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
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", True)
' Create IQ arb waveform named "TestArb" with 4000 points of 0-1 data
strDataCommand.Append("SOURce1:DATA:ARB2 TestArb")
' Specify IQ arb format
oFio.WriteString("DATA:ARB2:FORMAT AABB", True)
'Generating waveforms
'I
For I As Double = 1 To 5 ' Set rise time (5 points)
strDataCommand.Append("," + ((I - 1) / 5).ToString())
Next I
For I As Double = 6 To 205 ' Set pulse width (200 points)
strDataCommand.Append(",1")
Next I
For I As Double = 206 To 210 ' Set fall time (5 points)
strDataCommand.Append("," + ((210 - I) / 5).ToString())
Next I
For I As Double = 211 To 4000 ' Set remaining points to zero
strDataCommand.Append(",0")
Next I
'Q
For I As Double = 1 To 5 ' Set rise time (5 points)
strDataCommand.Append("," + ((I - 1) / 5).ToString())
Next I
For I As Double = 6 To 205 ' Set pulse width (200 points)
strDataCommand.Append(",1")
Next I
For I As Double = 206 To 210 ' Set fall time (5 points)
strDataCommand.Append("," + ((210 - I) / 5).ToString())
Next I
For I As Double = 211 To 4000 ' Set remaining points to zero
strDataCommand.Append(",0")
Next I
'Downloading waveform
Console.WriteLine("Downloading Waveform...")
oFio.WriteString(strDataCommand.ToString(), True)
oFio.WriteString("*OPC?", True)
oFio.ReadString()
Console.WriteLine("Download Complete\n")
'Set desired configuration
oFio.WriteString("SOURce1:FUNCtion ARB", True) ' turn on arb function
oFio.WriteString("SOURce1:FUNCtion:ARBitrary TestArb", True) ' set current arb waveform to defined arb pulse
oFio.WriteString("SOURCE1:VOLT 2", True) ' set max waveform amplitude to 2 Vpp
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", True) ' set offset to 0 V
oFio.WriteString("OUTPUT1:LOAD 50", True) ' set output load to 50 ohms
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 100E-6", True) ' set waveform period to 100uS
'Enable Output
oFio.WriteString("OUTPUT1 ON", True) ' turn on channel 1 output
'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:
*
* ASCII_IQ_ARB is a sample program that demonstrates how to download an IQ arbitrary waveform
* into instrument volatile memory and play back the same with the configuration below:
* This arb generates a 4000 point pulse waveform on both channels, of which the first 200 points define a
* positive pulse from 0 volts to the maximum defined voltage amplitude.
*
* Wave Shape: Arb
* Amplitude: 2 Volt Peak to Peak
* Offset: 0 Volt
* Output Impedance: 50 Ohm
* Channel1 and 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 Ascii_IQ_Arb
{
class Program
{
const string noErrString = "+0,\"No error\"\n";
static void Main(string[] args)
{
try
{
AsciiIQArb();
}
catch (Exception oExp)
{
Console.WriteLine(oExp.Message);
}
Console.WriteLine("Press [Enter] to exit");
Console.ReadLine();
}
public static void AsciiIQArb()
{
StringBuilder strDataCommand = new StringBuilder();
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
oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", true);
// Create IQ arb waveform named "TestArb" with 4000 points of 0-1 data
strDataCommand.Append("SOURce1:DATA:ARB2 TestArb");
// Specify IQ arb format
oFio.WriteString("DATA:ARB2:FORMAT AABB", true);
//Generating waveforms
//I
for (double i = 1; i <= 5; i++) /* Set rise time (5 points) */
strDataCommand.Append("," + ((i - 1) / 5).ToString());
for (double i = 6; i <= 205; i++) /* Set pulse width (200 points) */
strDataCommand.Append(",1");
for (double i = 206; i <= 210; i++) /* Set fall time (5 points) */
strDataCommand.Append("," + ((210 - i) / 5).ToString());
for (double i = 211; i <= 4000; i++)
strDataCommand.Append(",0"); /* Set remaining points to zero */
//Q
for (double i = 1; i <= 5; i++) /* Set rise time (5 points) */
strDataCommand.Append("," + ((i - 1) / 5).ToString());
for (double i = 6; i <= 205; i++) /* Set pulse width (200 points) */
strDataCommand.Append(",1");
for (double i = 206; i <= 210; i++) /* Set fall time (5 points) */
strDataCommand.Append("," + ((210 - i) / 5).ToString());
for (double i = 211; i <= 4000; i++)
strDataCommand.Append(",0"); /* Set remaining points to zero */
//Downloading waveform
Console.WriteLine("Downloading Waveform...");
oFio.WriteString(strDataCommand.ToString(), true);
oFio.WriteString("*OPC?", true);
oFio.ReadString();
Console.WriteLine("Download Complete\n");
//Set desired configuration
oFio.WriteString("SOURce1:FUNCtion ARB", true); // turn on arb function
oFio.WriteString("SOURce1:FUNCtion:ARBitrary TestArb", true); // set current arb waveform to defined arb pulse
oFio.WriteString("SOURCE1:VOLT 2", true); // set max waveform amplitude to 2 Vpp
oFio.WriteString("SOURCE1:VOLT:OFFSET 0", true); // set offset to 0 V
oFio.WriteString("OUTPUT1:LOAD 50", true); // set output load to 50 ohms
oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 100E-6", true); // set waveform period to 100uS
//Enable Output
oFio.WriteString("OUTPUT1 ON", true); // turn on channel 1 output
//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);
}
}
}
}