beautypg.com

Agilent Technologies N5700 User Manual

Page 84

background image

Trigger Programming Example

84

Series N5700 User’s Guide


' Use the following line instead for USB communication
' IOaddress = "USB0::2391::1799::US00000002"

' Initialize the VISA COM communication
Set ioMgr = New AgilentRMLib.SRMCls
Set Instrument = New VisaComLib.FormattedIO488
Set Instrument.IO = ioMgr.Open(GPIBaddress)

VoltSetting = 3 ' volts
CurrSetting = 1.5 ' amps
trigVoltSetting = 5 ' volts

With Instrument
' Send a power reset to the instrument
.WriteString "*RST"

' Query the instrument for the IDN string
.WriteString "*IDN?"
IDN = .ReadString

' Set the voltage
.WriteString "VOLT" & Str$(VoltSetting)

' Set the current level
.WriteString "CURR " & Str$(CurrSetting)

' Set the triggered voltage level
.WriteString "VOLT:TRIG " & Str$(trigVoltSetting)

' Turn the output on
.WriteString "OUTP ON"

' Measure the voltage before triggering the change
.WriteString "MEAS:VOLT?"
MeasureVoltString = .ReadString

' Save the value for later display
msg1 = "Voltage before trigger = " & MeasureVoltString

' Initiate the trigger system and send the trigger
.WriteString "INIT"
.WriteString "*TRG"

' Measure the voltage after triggering the change
.WriteString "MEAS:VOLT?"
MeasureVoltString = .ReadString

' Display the measured values
MsgBox msg1 + Chr$(13) + "Voltage after trigger = " & 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