AnsweredAssumed Answered

Agilent 33500A/33500B function gen SYNC ARB example program

Question asked by lhornburg Employee on Sep 13, 2012
Latest reply on Sep 13, 2012 by lhornburg
VB.net:

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' EXAMPLE DESCRIPTION:

' Sync_Arbs is a sample program that demonstrates how to call arbitrary waveforms and synchronize them together: 
'
'     Wave Shape: SINC.arb
'     Period:     10 usec
'     Amplitude:     2 Volt Peak to Peak
'     Offset:          0 Volt
'     Output Impedance:     50 Ohm
'     Channel1 Output: Enabled
'  Channel2 Output: Enabled
'
' Caution: All un-saved data present in volatile memory will be erased.
' Save information before proceeding to this example program.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
' BUILDING THIS EXAMPLE:

' This sample program is intended to be used with Microsoft Visual C# 2005, 
' or later, and the VISA COM library.

' Sample program execution requires the VISA COM library as a prerequisite,
' which is installed by the Agilent IO Libraries Suite.
' Sample program uses VISA COM 3.0 Type Library as a reference to the 
' VISA COM library:

' $(VXIPNPPATH)\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright © 2012 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.
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Imports System.Text
'Add VISA COM library reference.
Imports Ivi.Visa.Interop


Module Module1

    Const noErrString As String = "+0,""No error""" + vbLf

    Sub Main()

        Try

            SyncArbs()

        Catch oExp As Exception

            Console.WriteLine(oExp.Message)

        End Try

        Console.WriteLine("Press [Enter] to exit")
        Console.ReadLine()

    End Sub

    Sub SyncArbs()


        Dim instAddress As String = "TCPIP0::156.140.113.206::inst0::INSTR"
        Dim oRm As New ResourceManagerClass()
        Dim oFio As New FormattedIO488Class()

        'Open session for instrument.
        oFio.IO = oRm.Open(instAddress, AccessMode.NO_LOCK, 2000, "")
        oFio.IO.Timeout = 10000

        'Query Idendity string and report.
        oFio.WriteString("*IDN?", True)
        Dim strResult As String = oFio.ReadString()

        Console.WriteLine("Instrument Identity String: " + strResult)

        'Clear and reset instrument
        oFio.WriteString("*CLS;*RST;*OPC?", True)
        oFio.ReadString()

        'Clear volatile memory on channel 1
        oFio.WriteString("SOURce1:DATA:VOLatile:CLEar", True)

        'Load and configure arb for channel 1 
        oFio.WriteString("MMEM:LOAD:DATA1 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
        oFio.WriteString("*WAI", True) ' wait for operations to complete before moving on
        oFio.WriteString("SOURce1:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
        oFio.WriteString("SOURce1:FUNCtion ARB", True) ' turn on the arbitrary waveform
        oFio.WriteString("SOURCE1:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
        oFio.WriteString("SOURCE1:VOLT 2", True) ' set the max voltage to 2VPP
        oFio.WriteString("SOURCE1:VOLT:OFFSET 0", True) ' set the offset to 0VDC
        oFio.WriteString("OUTPUT1:LOAD 50", True) ' set the output load to 50 ohms

        'Clear volatile memory on channel 2
        oFio.WriteString("SOURce2:DATA:VOLatile:CLEar", True)

        'Load and configure arb for channel 2 
        oFio.WriteString("MMEM:LOAD:DATA2 ""INT:\BUILTIN\SINC.ARB""", True) ' Load SINC.ARB into volatile memory
        oFio.WriteString("*WAI", True)  ' wait for operations to complete before moving on
        oFio.WriteString("SOURce2:FUNCtion:ARB ""INT:\BUILTIN\SINC.ARB""", True) ' Make Sinc.arb the active arb
        oFio.WriteString("SOURce2:FUNCtion ARB", True) ' turn on the arbitrary waveform
        oFio.WriteString("SOURCE2:FUNCtion:ARB:PER 10E-6", True) ' set the period to 10uS
        oFio.WriteString("SOURCE2:VOLT 2", True) ' set the max voltage to 2VPP
        oFio.WriteString("SOURCE2:VOLT:OFFSET 0", True) ' set the offset to 0VDC
        oFio.WriteString("OUTPUT2:LOAD 50", True) ' set the output load to 50 ohms

        'Enable outputs.
        oFio.WriteString("OUTPUT1 ON", True)
        oFio.WriteString("OUTPUT2 ON", True)

        'Synchronize the arb waveforms
        oFio.WriteString("FUNC:ARB:SYNC", True)

        'Read Errors
        oFio.WriteString("SYSTEM:ERROR?", True)
        strResult = oFio.ReadString()

        If strResult = noErrString Then
            Console.WriteLine("Output set without any error" + vbLf)
        Else
            Console.WriteLine("Error reported: " + strResult)
        End If

    End Sub

End Module  

Attachments

Outcomes