AnsweredAssumed Answered

Agilent 33500A/33500B function gen Pulse example program

Question asked by lhornburg Employee on Aug 30, 2012
Latest reply on Aug 30, 2012 by lhornburg

    ' Copyright © 2010 Agilent Technologies Inc. All rights reserved
    ' You have a royalty-free right to use, modify, reproduce and distribute
    ' the Sample Application Files (and/or any modified version) in any way
    ' you find useful, provided that you agree that Agilent has no
    ' warranty, obligations or liability for any Sample Application Files.
    ' Agilent Technologies provides programming examples for illustration only.
    ' This sample program assumes that you are familiar with the programming
    ' language being demonstrated and the tools and procedures used to create
    ' and debug them. Agilent support engineers can help explain the
    ' functionality of Agilent software components and associated
    ' commands, but they will not modify these samples to provide added
    ' functionality or construct procedures to meet your specific needs.

    'This sample program is intended for use with Microsoft Visual studio 6.0
    'and Agilent Visa Object library.
    'Sample program execution requires VISA library installation.
    'Add the libraries listed below in Project\reference menu before executing the 
    'sample program:
    'VISA COM 3.0 Type Library, Location: \VisaCom\GlobMgr.dll
    'VISA COM 488.2 Formatted I/O 1.0, Location: \VisaCom\BasFrmIO.dll
    'VISA COM Resource Manager 1.0, Location: \bin\AgtRM.dll
' ****************************************************************************

' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'This Pulse program enables a simple pulse wave output on channel 1 of a 
'33500 Series instrument with signal characteristics given below.  A loop
'in the program increases the edge transition time by 10 nsec every 100 msec.

'Wave Shape:            Pulse
'Frequency:             100 KHz
'Amplitude:             2 Volts Peak to Peak
'Offset:                0 Volt
'Edge Transition Time:  Variable (10 ns to 100 ns in 10 ns steps every 100 msec)
'Channel1 Output:       Enabled
' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()

    Dim io_mgr As VisaComLib.ResourceManager
    Dim mfIo As VisaComLib.FormattedIO488
    Dim i As Integer
    Set io_mgr = New AgilentRMLib.SRMCls
    Set mfIo = New FormattedIO488
    Set mfIo.IO = io_mgr.Open(Text1.Text, NO_LOCK, 2000, "")
    On Error GoTo MyError
    ' This program sets up a waveform by selecting the waveshape
    ' and adjusting the frequency, amplitude, and offset.
    With mfIo
        'Clear and reset instrument
        .WriteString "*CLS"
        .WriteString "*RST"
         Sleep 1000
        'Set function to Pulse.
        .WriteString "SOURCE1:FUNCTION PULSE"

        'Set pulse period (sec) & voltage
        .WriteString "SOURCE1:FUNCTION:PULSE:PERIOD 1E-3"
        .WriteString "SOURCE1:VOLT 5"

        'Set Duty Cycle to 50%
        .WriteString "SOURCE1:FUNCTION:PULSE:DCYCLE 50"
        'Enable output.
        .WriteString "OUTPUT1 ON"
        Sleep 1000
        ' Iterate over different pulse transition durations
        For i = 1 To 10
            .WriteString "SOURCE1:FUNCtion:PULSe:TRANsition " & (i * 10) & "E-9"
            Sleep 100
        Next i
    End With
    Text2.Text = "Pulse output with variable edge time set on Channel1"
Exit Sub

    Text2 = Err.Description
    Resume Next
End Sub

Private Sub Form_Load()

    Text2.Text = ""
End Sub