306
Chapter 6 Application Programs
Program Listings
6
Example: Pulse Width Modulation (PWM)
This program (found in the “Examples\chapter6\PulseWidthMod” subdirectory on the
CD-ROM) configures a pulse waveform with duty cycle, which is then slowly modulated
by a triangle waveform.
Private Sub cmdPWM_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 uses low-level SCPI commands to configure
' the function gnerator to output an PWM waveform.
' The pulse is set up with a duty cycle of 35% and a depth
' of 15%, and will vary in width from 20% to 50% with the
' modulation. The pulse may also be configured in time
' units (pulse width and deviation) rather than duty cycle
' if preferred.
With Fgen
.WriteString "*RST" ' Reset the function generator
.IO.Clear ' Clear errors & status registers
.WriteString "OUTPut:LOAD 50" ' Output termination is 50 Ohms
.WriteString "FUNCtion:SHAPe PULSe" ' Carrier waveshape is pulse
.WriteString "FREQuency 5000" ' Carrier frequency is 5 kHz
.WriteString "VOLTage:LOW 0" ' Set parameters to 5 V TTL
.WriteString "VOLTage:HIGH 5"
.WriteString "FUNCtion:PULSe:DCYCle 35" ' Begin with 35% duty cycle
.WriteString "PWM:INTernal:FUNCtion TRIangle" ' Modulating waveshape
' is triangle
.WriteString "PWM:INTernal:FREQuency 2" ' Modulation frequency is 2 Hz
.WriteString "PWM:DEViation:DCYCle 15" ' Modulation depth is 15%
.WriteString "PWM:SOURce INTernal" ' Use internal signal for
' modulation
' If using an external signal for PWM, connect the signal to the
' rear-panel BNC and use the command PWM:SOURce EXTernal
.WriteString "PWM:STATe ON" ' Turn PWM modulation on
.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 306 Wednesday, July 16, 2008 11:16 AM
Содержание 33210A
Страница 1: ...Keysight 33210A 10 MHz Function Arbitrary Waveform Generator User s Guide ...
Страница 2: ......
Страница 3: ......
Страница 14: ...12 Contents Contents 33210A users guide book Page 12 Wednesday July 16 2008 11 16 AM ...
Страница 15: ...1 1 Quick Start 33210A users guide book Page 13 Wednesday July 16 2008 11 16 AM ...
Страница 33: ...2 2 Front Panel Menu Operation 33210A users guide book Page 31 Wednesday July 16 2008 11 16 AM ...
Страница 53: ...3 3 Features and Functions 33210A users guide book Page 51 Wednesday July 16 2008 11 16 AM ...
Страница 147: ...4 4 Remote Interface Reference 33210A users guide book Page 145 Wednesday July 16 2008 11 16 AM ...
Страница 273: ...5 5 Error Messages 33210A users guide book Page 271 Wednesday July 16 2008 11 16 AM ...
Страница 301: ...6 6 Application Programs 33210A users guide book Page 299 Wednesday July 16 2008 11 16 AM ...
Страница 311: ...7 7 Tutorial 33210A users guide book Page 309 Wednesday July 16 2008 11 16 AM ...
Страница 335: ...8 8 Specifications 33210A users guide book Page 333 Wednesday July 16 2008 11 16 AM ...