6
Programming Examples
88
Series N8700 User’s Guide
Output Programming Example
This program sets the voltage, current, over-voltage, and the over-
current protection. It turns the output on and takes a voltage
measurement. When done, the program checks for instrument errors
and gives a message if there is an error.
Sub main_EZ()
Dim IDN As String
Dim IOaddress As String
Dim ErrString As String
' This variable controls the voltage
Dim VoltSetting As Double
' This variable measures the voltage
Dim measVolt As Double
' This variable controls the current
Dim CurrSetting As Double
' These variables control the over voltage protection settings
Dim overVoltSetting As Double
' These variables control the over current protection
Dim overCurrOn As Long
'These variable are neccessary to initialize the VISA COM.
Dim ioMgr As KeysightRMLib.SRMCls
Dim Instrument As VisaComLib.FormattedIO488
' The following command line provides the program with the VISA name of the
' interface that it will communicate with. It is currently set to use GPIB.
IOaddress = "GPIB0::5::INSTR"
' Use the following line 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
CurrSetting = 1.5 ' amps
overVoltSetting = 10
overCurrOn = 1 '1 for on, 0 for off
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)