Example: Pulse Width Modulation (Pwm) - Keysight Technologies 33210A User Manual

10 mhz function/arbitrary waveform generator
Hide thumbs Also See for 33210A:
Table of Contents

Advertisement

6
Application Programs
End Sub

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()
336
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"
.IO.Clear
.WriteString "OUTPut:LOAD 50"
.WriteString "FUNCtion:SHAPe PULSe"
.WriteString "FREQuency 5000"
.WriteString "VOLTage:LOW 0"
.WriteString "VOLTage:HIGH 5"
.WriteString "FUNCtion:PULSe:DCYCle 35"
.WriteString "PWM:INTernal:FUNCtion TRIangle"
.WriteString "PWM:INTernal:FREQuency 2"
.WriteString "PWM:DEViation:DCYCle 15"
.WriteString "PWM:SOURce INTernal"
' 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"
.WriteString "OUTPut ON"
End With
Exit Sub
' Reset the function generator
' Clear errors & status registers
' Output termination is 50 Ohms
' Carrier waveshape is pulse
' Carrier frequency is 5 kHz
' Set parameters to 5 V TTL
' Begin with 35% duty cycle
' Modulating waveshape
' is triangle
' Modulation frequency is 2 Hz
' Modulation depth is 15%
' Use internal signal for
' modulation
' Turn PWM modulation on
' Turn on the instrument output
Keysight 33210A User's Guide

Advertisement

Table of Contents
loading

Table of Contents