Agilent Technologies System DC N5700 User Manual

Page 85

Advertising
background image

Programming Examples 6

Series N5700 User’s Guide

85


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

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

' Set the triggered voltage and current levels
.WriteString "VOLT:TRIG " & Str$(trigVoltSetting)
.WriteString "CURR:TRIG " & Str$(trigCurrSetting)

' Turn the output on
.WriteString "OUTP ON"

' Make sure that the output is on
.WriteString "*OPC?"
.ReadString

' Measure the voltage before triggering the change
.WriteString "MEAS:VOLT?"
MeasureVolt = .ReadNumber

' Save the value for later display
msg1$ = "Voltage before trigger = " & Str$(MeasureVolt)

' Initiate the trigger system
.WriteString "INIT"

' Make sure that the trigger system is initiated
Do
.WriteString "STAT:OPER:COND?"
stat = .ReadNumber
Loop Until ((stat And WTG) = WTG)

' Trigger the unit
.WriteString "*TRG"

'Make sure that the trigger is done
.WriteString "*OPC?"
.ReadString

' Measure the voltage after triggering the change
.WriteString "MEAS:VOLT?"
MeasureVolt = .ReadNumber

' Display the measured values
MsgBox msg1$ + Chr$(13) + "Voltage after trigger = " & Str$(MeasureVolt)

' 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

Advertising