Thread: Agilent 33500A/33500B function gen Amplitude Modulation example program


Permlink Replies: 2 - Pages: 1 - Last Post: Aug 24, 2012 5:32 PM Last Post By: lhornburg
lhornburg

Posts: 475
Registered: 01/15/10
Agilent 33500A/33500B function gen Amplitude Modulation example program
Posted: Aug 24, 2012 5:24 PM
Click to report abuse...   Click to reply to this thread Reply
VB:

'****************************************************************************
' Copyright © 2010 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.
'****************************************************************************

'****************************************************************************
'This sample program is intended to use with Microsoft Visual studio 6.0
'and Agilent Visa Object library.
'
'Sample program execution requires VISA library installation as pre requisites.
'
'Add below libraries in project reference in Project\reference menu prior to execution of sample 'program:
'VISA COM 3.0 Type Library, Location: <visa install location>\VisaCom\GlobMgr.dll
'VISA COM 488.2 Formatted I/O 1.0, Location: <visa install location>\VisaCom\BasFrmIO.dll
'VISA COM Resource Manager 1.0, Location: <Agilent IO Library install>\bin\AgtRM.dll
' ****************************************************************************

Private Sub Command1_Click()
' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'Amplitude Modulation is a sample program enable a Amplitude modulation output on first channel of 3352XA instrument with following signal specification
'
'Carrier Frequency: Sin wave, 1 Mhz, 5 VPP
'Amplitude Modulated carrier with Double Sideband Suppressed Carrier
'
'Modulating Frequency: Sin Wave, 1 KHz
'AM Depth 100%
' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Dim io_mgr As VisaComLib.ResourceManager
Dim mfIo As VisaComLib.FormattedIO488

Set io_mgr = New AgilentRMLib.SRMCls
Set mfIo = New FormattedIO488
Set mfIo.IO = io_mgr.Open(Text1.Text, NO_LOCK, 2000, "")

On Error GoTo MyError

' This program sets up a waveform by selecting the waveshape
' and adjusting the frequency, amplitude, and offset.

With mfIo

'Reset and clear instrument
.WriteString "*RST"
.IO.Clear

'Configure the carrier waveform
.WriteString "SOURCE1:FUNC SIN"
.WriteString "SOURCE1:FREQ 10E5"
.WriteString "SOURCE1:VOLT:UNIT VPP"
.WriteString "SOURCE1:VOLT 5"

'Select the mode of Amplitude Modulation
.WriteString "SOURCE1:AM:DSSC ON"

'Select the modulation source
.WriteString "SOURCE1:AM:SOURCE INT"

'Select the shape of the modulating waveform
.WriteString "SOURCE1:AM:INT:FUNC SIN"

'Set the modulating frequency
.WriteString "SOURCE1:AM:INT:FREQ 1000"

'Set the modulation depth
.WriteString "SOURCE1:AM:DEPTH 100"

'Enable AM Modulation
.WriteString "SOURCE1:AM:STATE ON"

'Enable output.
.WriteString "OUTPUT1 ON"

End With

Text2.Text = "Amplitude modulation output enabled"

Exit Sub

MyError:

Text2 = Err.Description
Resume Next

End Sub

Private Sub Form_Load()

Text2.Text = ""

End Sub

lhornburg

Posts: 475
Registered: 01/15/10
Re: Agilent 33500A/33500B function gen Amplitude Modulation example program
Posted: Aug 24, 2012 5:30 PM   in response to: lhornburg in response to: lhornburg
Click to report abuse...   Click to reply to this thread Reply
C:

/****************************************************************************
' Copyright © 2010 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.
****************************************************************************/

/****************************************************************************
'This sample program is intended for use with Microsoft Visual C++ 2005
'and Agilent Visa Object library.
'
'Sample program execution requires VISA library installation.
'
'The header file <visa.h> used in the project should be available
'at the VISA install location, and the user must point to the file
'if it is not detected automatically. Add the directory containing the
'header file as and additional dependency for C/C++ project compilation.
'
'Add the visa32.lib library reference as and additional dependencies for the linker
'in this project. This library can be located at <VISA Install location>\WinNT\lib\msc.
'
****************************************************************************/
/*
Amplitude Modulation is a sample program that enables an Amplitude modulation output on channel 1
of a 33500 Series instrument with the following signal characteristics:

Baseband Signal:
Wave Shape: Sine Wave
Frequency: 1 KHz

Carrier Signal:
Wave Shape: Sine Wave
Frequency: 1 MHz

Modulation
Type: Amplitude Modulation
DSSC: ON (with double sideband supressed carrier)
AM Depth: 100%
*/

#include <visa.h>
#include <stdio.h>
#include <string.h>

void main ()
{
ViSession oRM, MFio;
char strResult256 = {0};
char noErrString256 = {"+0,\"No error\"\n"};
char buf 256 = {0};

// Enter VISA address of instrument to access
char InstAdd[] = "TCPIP0::146.223.123.106::inst0::INSTR";

/* Open session for above address */
viOpenDefaultRM (&oRM);
viOpen (oRM, InstAdd, VI_NULL,VI_NULL, &MFio);

/* Send an *IDN? string to the device */
viPrintf (MFio, "*IDN?\n");

/* Read results */
viScanf (MFio, "%t", &buf);

/* Print results */
printf ("Instrument identification string: %s\n", buf);

//Set up Amplitude modulation output.

//Clear and reset instrument
viPrintf(oMIO,"*CLS\n");
viPrintf(MFio,"*RST\n");

//Configure the carrier waveform
viPrintf(MFio,"SOURCE1:FUNC SIN\n");
viPrintf(MFio,"SOURCE1:FREQ 10E5\n");
viPrintf(MFio,"SOURCE1:VOLT 5\n");

//Select the mode of Amplitude Modulation
viPrintf(MFio,"SOURCE1:AM:DSSC ON\n");

//Select the modulation source
viPrintf(MFio,"SOURCE1:AM:SOURCE INT\n");

//Select the shape of the modulating waveform:
viPrintf(MFio,"SOURCE1:AM:INT:FUNC SIN\n");

//Set the modulating frequency
viPrintf(MFio,"SOURCE1:AM:INT:FREQ 1000\n");

//Set the modulation depth
viPrintf(MFio,"SOURCE1:AM:DEPTH 100\n");

//Enable AM Modulation
viPrintf(MFio,"SOURCE1:AM:STATE ON\n");

//Enable Channel output
viPrintf(MFio,"OUTP1 ON\n");

//Read Error
viQueryf(MFio,"SYST:ERR?\n","%t",&strResult);

if(!(strcmp(strResult,noErrString)))
{
printf("Amplitude Modulation waveform generated without any error\n");
}
else
{
printf("Error reported: %s",strResult);
}

//Exit
printf("\nPress Enter to exit");
getchar();

/* Close session */
viClose (oRM);
viClose (MFio);

}
lhornburg

Posts: 475
Registered: 01/15/10
Re: Agilent 33500A/33500B function gen Amplitude Modulation example program
Posted: Aug 24, 2012 5:32 PM   in response to: lhornburg in response to: lhornburg
Click to report abuse...   Click to reply to this thread Reply
C#

/****************************************************************************
' Copyright © 2010 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.
'****************************************************************************

'****************************************************************************
'This sample program is intended to use with Microsoft Visual C# 2005
'and Agilent Visa Object library.
'
'Sample program execution requires VISA library installation as prerequisite.
'
'Sample program uses VISA COM 3.0 Type Library as reference to VISA library at below location:
'<visa install location>\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
'User must point to the file, if not detected automatically.
' ****************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;
//Adding visa liberary reference
using Ivi.Visa.Interop;

//Amplitude Modulation is a sample program that enables a Amplitude modulation output on channel 1
//of 3352XA instrument with the following signal characteristics
//
//Carrier Frequency: Sin wave, 1 Mhz, 5 VPP
//Amplitude Modulated carrier with Double Sideband Suppressed Carrier
//
//Modulating Frequency: Sin Wave, 1 KHz
//AM Depth 100%

namespace Amplitude_Modulation
{
class Program
{
//No error message
const string noErrString = "+0,\"No error\"\n";

static void Main(string[] args)
{
try
{
AMModulation();
}
catch (Exception oExp)
{
Console.WriteLine(oExp.Message);
}

Console.WriteLine("Press Enter to exit");
Console.ReadLine();

}

public static void AMModulation()
{
//Set Instrument address
string instAddress = "TCPIP0::156.140.95.225::inst0::INSTR";

ResourceManagerClass oRm = new ResourceManagerClass();
FormattedIO488Class oFio = new FormattedIO488Class();

//Open session for instrument.
oFio.IO = (IMessage)oRm.Open(instAddress, AccessMode.NO_LOCK, 2000, "");

//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", true);

//Configure the carrier waveform
oFio.WriteString("SOURCE1:FUNC SIN",true);
oFio.WriteString("SOURCE1:FREQ 10E5", true);
oFio.WriteString("SOURCE1:VOLT 5", true);

//Select the mode of Amplitude Modulation
oFio.WriteString("SOURCE1:AM:DSSC ON", true);

//Select the modulation source
oFio.WriteString("SOURCE1:AM:SOURCE INT", true);

//Select the shape of the modulating waveform:
oFio.WriteString("SOURCE1:AM:INT:FUNC SIN", true);

//Set the modulating frequency
oFio.WriteString("SOURCE1:AM:INT:FREQ 1000", true);

//Set the modulation depth
oFio.WriteString("SOURCE1:AM:DEPTH 100", true);

//Enable AM Modulation
oFio.WriteString("SOURCE1:AM:STATE ON", true);

//Enable Output
oFio.WriteString("OUTPUT1 ON", true);

//Read Error
oFio.WriteString("SYSTEM:ERROR?", true);
strResult = oFio.ReadString();

if (strResult == noErrString)
{
Console.WriteLine("Amplitude Modulation output enabled without any error\n");
}
else
{
Console.WriteLine("Error reported: " + strResult);
}

}

}
}


Point your RSS reader here for a feed of the latest messages in all forums