302
Chapter 6 Application Programs
Program Listings
6
Program Listings
Example: A Simple Sine Waveform
This program (found in the “Examples\chapter6\SimpleSine” subdirectory on the CD-
ROM) selects the function as “sine,” and then sets the frequency, amplitude and offset of
the waveform.
Private Sub cmdSimpleSine_Click()
Dim io_mgr As VisaComLib.ResourceManager
Dim Fgen As VisaComLib.FormattedIO488
Set io_mgr = New VisaComLib.ResourceManager
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
' Other options are SQUare, RAMP, PULSe, NOISe, DC, and USER
.WriteString "OUTPut:LOAD 50"
' Set the load impedance in Ohms
' (50 Ohms default)
' May also be INFinity, as when using oscilloscope or DMM
.WriteString "FREQuency 2500"
' Set the frequency.
.WriteString "VOLTage 1.2"
' Set the amplitude in Vpp.
' Also see VOLTage:UNIT
.WriteString "VOLTage:OFFSet 0.4"
' Set the offset in Volts
' Voltage may also be set as VOLTage:HIGH and VOLTage:LOW for low level
' and high level
.WriteString "OUTPut ON"
' Turn on the instrument output
End With
Exit Sub
MyError:
txtError = Err.Description & vbCrLf
Resume Next
End Sub
33210A users guide.book Page 302 Wednesday, July 16, 2008 11:16 AM
Summary of Contents for 33210A
Page 1: ...Keysight 33210A 10 MHz Function Arbitrary Waveform Generator User s Guide ...
Page 2: ......
Page 3: ......
Page 14: ...12 Contents Contents 33210A users guide book Page 12 Wednesday July 16 2008 11 16 AM ...
Page 15: ...1 1 Quick Start 33210A users guide book Page 13 Wednesday July 16 2008 11 16 AM ...
Page 53: ...3 3 Features and Functions 33210A users guide book Page 51 Wednesday July 16 2008 11 16 AM ...
Page 273: ...5 5 Error Messages 33210A users guide book Page 271 Wednesday July 16 2008 11 16 AM ...
Page 301: ...6 6 Application Programs 33210A users guide book Page 299 Wednesday July 16 2008 11 16 AM ...
Page 311: ...7 7 Tutorial 33210A users guide book Page 309 Wednesday July 16 2008 11 16 AM ...
Page 335: ...8 8 Specifications 33210A users guide book Page 333 Wednesday July 16 2008 11 16 AM ...