User`s guide

91
Programming Your Instruments
Example Programs
Example Programs
Four example programs follow to demonstrate sine waveform generation
for an Agilent 33220A 20 Mhz Function/Arbitrary Waveform Generator. The
example programs are essentially repeated to show the same functionality
with different programming environments and I/O. See the Agilent IntuiLink
for the 33220A Waveform Generator CD for other program examples. The
example programs are:
! Example: Simple Sine Waveform (Visual Basic and VISA-COM)
! Example: Simple Sine Waveform (Visual C++ and IVI-COM)
! Example: Simple Sine Waveform (Visual C++ and VXIpnp)
! Example: Simple Sine Waveform (Visual C++ and VISA)
Example: Simple Sine Waveform (Visual Basic and VISA-COM)
This program selects the function as “sine,” and then sets the frequency,
amplitude and offset of the waveform for an Agilent 33220A. The program
is written in Visual Basic 6.0 and uses VISA-COM.
Private Sub cmdSimpleSine_Click()
Dim io_mgr As VisaComLib.ResourceManager
Dim Fgen As VisaComLib.FormattedIO488
Set io_mgr = New AgilentRMLib.SRMCls
Set Fgen = New VisaComLib.FormattedIO488
Set Fgen.IO = io_mgr.Open(txtIO.Text)
On Error GoTo MyError
’ This program sets up a waveform by selecting the waveshape
’ and adjusting the frequency, amplitude, and offset.
With Fgen
.WriteString "*RST" ’ Reset the function generator
.IO.Clear ’ Clear errors and status
registers
.WriteString "FUNCtion SINusoid" ’ Select waveshape