317
Chapter 6 Application Programs
Program Listings
4
6
Example: A Pulse Waveform
This program (found in the “Examples\chapter6\Pulse” subdirectory on the CD-ROM)
configures a pulse waveform, setting pulse width, period, and high/low levels. The edge
time is then incremented.
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub cmdPulse_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 I As Integer
On Error GoTo MyError
' This program sets up a pulse waveshape and adjusts the edge
' time. It also shows the use of high and low voltage levels
' and period. The edge time is adjusted by 5 nsec increments.
With Fgen
.WriteString "*RST" ' Reset the function generator
.IO.Clear ' Clear errors and status registers
.WriteString "FUNCtion PULSe" ' Select pulse waveshape
.WriteString "OUTPut:LOAD 50" ' Set the load impedance to 50 Ohms
' (default)
.WriteString "VOLTage:LOW 0" ' Low level = 0 V
.WriteString "VOLTage:HIGH 0.75" ' High level = .75 V
.WriteString "PULSe:PERiod 1e-3" ' 1 ms intervals
.WriteString "PULSe:WIDTh 100e-6" ' Pulse width is 100 us
.WriteString "PULSe:TRANsition 10e-9" ' Edge time is 10 ns
' (rise time = fall time)
.WriteString "OUTPut ON" ' Turn on the instrument output
For I = 0 To 18
' Vary edge by 5 nsec steps
.WriteString "PULSe:TRANsition " & (0.00000001 + I * 0.000000005)
Sleep 300 ' Wait 300 msec
Next I
End With
Exit Sub
MyError:
txtError = Err.Description & vbCrLf
Resume Next
End Sub