AnsweredAssumed Answered

33500A/33500B function generator linear sweep example program

Question asked by lhornburg Employee on Aug 24, 2012
Latest reply on Aug 24, 2012 by lhornburg
vb:

'****************************************************************************
    '    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 used to create and debug
    ' procedures. 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 to use with Microsoft Visual studio 6.0
    'and Agilent Visa Object library.
    '
    'Sample program execution requires VISA library installation as pre requisites.
    '
    'Add below libraries in project reference in Project\reference menu prior to execution of 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
' ****************************************************************************



' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'Linear Sweep is a sample program enable a simple sine sweep wave output on first channel of 3352XA instrument with following signal specification

'Wave Shape:         Sine
'Amplitude:          2 Volt Peak to Peak
'Start Frequency:    20 Hz
'Start Frequency:    20 KHz
'Sweep fashion:      Linear
'Sweep Time;         2 Sec / sweep
'Trigger Source:     Immediate

'Channel1 Output: Enabled
' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Private Sub Command1_Click()
    
    Dim io_mgr As VisaComLib.ResourceManager
    Dim mfIo As VisaComLib.FormattedIO488
    
    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
    
        'Reset and clear instrument
         .WriteString "*RST"
        .IO.Clear
        
        'Select the waveform shape, amplitude and offset
        .WriteString "SOURCE1:FUNCTION SIN"
        .WriteString "SOURCE1:VOLT:UNIT VPP"
        .WriteString "SOURCE1:VOLT 2"
    
        'Select the frequency boundaries of the sweep
        .WriteString "SOURCE1:FREQUENCY:START 20"
        .WriteString "SOURCE1:FREQUENCY:STOP 20E3"
        
        'Select the sweep mode
        .WriteString "SOURCE1:SWEEP:SPACING LINEAR"
    
        'Set the sweep time in seconds.
        .WriteString "SOURCE1:SWEEP:TIME 2"
    
        'Select the sweep trigger source
        .WriteString "TRIGGER1:SOURCE IMM"
    
        'Enable Sweep State.
        .WriteString "SOURCE1:SWEEP:STATE ON"
       
        'Enable output.
        .WriteString "OUTPUT1 ON"
                
    End With
    Text2.Text = "Sweep Output enabled"
    
  
Exit Sub

MyError:
    
    Text2 = Err.Description
    Resume Next
   
End Sub

Private Sub Form_Load()

    Text2.Text = ""
    
End Sub

Attachments

Outcomes