6
Programming Examples
90
Series N8700 User’s Guide
Trigger Programming Example
This example illustrates how to set up and trigger a voltage and
current 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 is used to monitor the status
Dim stat As Long
' This variable controls the voltage
Dim VoltSetting As Double
' This variable measures the voltage
Dim MeasureVolt As Double
' This variable controls the current
Dim CurrSetting As Double
' This variable represents the trigger current setting
Dim trigCurrSetting As Double
' This variable controls the triggered voltage setting
Dim trigVoltSetting As Double
' This constant represents the register value for Waiting for Trigger
Const WTG = 32
' These variables are necessary to initialize the VISA COM
Dim ioMgr As KeysightRMLib.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"
' Use the following line instead for USB communication
' IOaddress = "USB0::2391::1799::N8741A-US00000002"
' Initialize the VISA COM communication
Set ioMgr = New KeysightRMLib.SRMCls
Set Instrument = New VisaComLib.FormattedIO488
Set Instrument.IO = ioMgr.Open(IOaddress)
VoltSetting = 3 ' volts
CurrSetting = 2 ' amps
trigVoltSetting = 5 ' volts
trigCurrSetting = 3 ' amps
With Instrument
' Send a power reset to the instrument
.WriteString "*RST"
' Query the instrument for the IDN string
.WriteString "*IDN?"
IDN = .ReadString