307
Chapter 6 Application Programs
Program Listings
4
6
Example: Downloading an Arbitrary Waveform (ASCII)
This program (found in the “Examples\chapter6\ASCIIarb” subdirectory on the CD-
ROM) downloads an arbitrary waveform to the function generator as ASCII data. Data
values are in the range -1 to +1.
Private Sub cmdASCIIArb_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)
Dim Waveform() As String
Dim I As Integer
Dim DataStr As String
ReDim Waveform(1 To 4000)
On Error GoTo MyError
' This program uses the arbitrary waveform function to
' download and output a square wave pulse with a calculated
' rise time and fall time. The waveform consists of 4000
' points downloaded to the function generator as ASCII data.
With Fgen
.WriteString "*RST" ' Reset the function generator
.IO.Clear ' Clear errors and status registers
.IO.Timeout = 40000 ' Set timeout to 40 seconds for long
' download strings
End With
' Compute waveform
txtError.Text = ""
txtError.SelText = "Computing Waveform..." & vbCrLf
For I = 1 To 5
Waveform(I) = Str$((I - 1) / 5) ' Set rise time (5 points)
Next I
For I = 6 To 205
Waveform(I) = "1" ' Set pulse width (200 points)
Next I
For I = 206 To 210
Waveform(I) = Str$((210 - I) / 5) ' Set fall time (5 points)
Next I
For I = 211 To 4000
Waveform(I) = "0" ' Set remaining points to zero
Next I
DataStr = Join(Waveform, ",") ' Create string from data array
Continued...
33210A users guide.book Page 307 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 ...