Agilent Technologies N5700 User Manual

Page of 128
Trigger Programming Example 
Series N5700 User’s Guide 
83 
        ' Set the over voltage level 
        .WriteString "VOLT:PROT:LEV " & Str$(overVoltSetting) 
 
        ' Set the current level 
        .WriteString "CURR " & Str$(CurrSetting) 
 
        ' Turn on over current protection 
        .WriteString "CURR:PROT:STAT " & Str$(overCurrentOn) 
 
        ' Turn the output on 
        .WriteString "OUTP ON" 
 
        ' Measure the voltage 
        .WriteString "MEAS:VOLT?" 
        MeasureVoltString = .ReadString 
        MsgBox "Measured Voltage is " & MeasureVoltString 
 
        ' Check instrument for any errors 
        .WriteString "Syst:err?" 
        ErrString = .ReadString 
 
        ' Give message if there is an error 
        If Val(ErrString) Then 
            MsgBox "Error in instrument!" & vbCrLf & ErrString 
        End If 
    End With 
 
End Sub
 
Trigger Programming Example 
This example illustrates how to set up and trigger an output voltage 
change. The voltage is measured before and after the trigger. 
 
Sub main_Trig() 
    Dim IDN As String 
    Dim IOaddress As String 
    Dim ErrString As String 
    Dim msg1 As String 
 
    ' This variable controls the voltage 
    Dim VoltSetting As Double 
 
    ' This variable measures the voltage 
    Dim MeasureVoltString As String 
 
    ' This variable controls the current 
    Dim CurrSetting As Double 
 
    ' This variable controls the triggered voltage setting 
    Dim trigVoltSetting As Double 
 
    ' These variables are necessary to initialize the VISA COM 
    Dim ioMgr As AgilentRMLib.SRMCls 
    Dim Instrument As VisaComLib.FormattedIO488 
 
    ' The following line provides the VISA name of the GPIB interface 
    IOaddress = "GPIB0::5::INSTR" 
 
    ' Use the following line instead for LAN communication 
    ' IOaddress="TCPIP0::141.25.36.214"