Agilent Technologies E3633A User Manual page 142

Dc power supplies
Hide thumbs Also See for E3633A:
Table of Contents

Advertisement

Chapter 6 Application Programs
Example Program for Excel 97
Diode Macro
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
' This is the subroutine first executed. Modify this routine to suit
' your needs. To change the GPIB address, go to the module OpenPort, and
' change the variable GPIB_Address = "5" to the required GPIB address.
' To change the RS-232 port, go to the moudle OpenPort, and change the
' variable COM_Address = "1" to the required port
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Global defaultRM As Long
Global power_supply As Long ' Identifies power supply
Global bGPIB As Boolean
Global ErrorStatus As Long
Sub Diode_Click()
Range("B5:B15").ClearContents
Dim I As Integer
bGPIB = True
OpenPort
SendSCPI "*RST"
SendSCPI "Output on"
For I = 5 To 15
SendSCPI "Volt " & Str$(Cells(I, 1))
Cells(I, 2) = Val(SendSCPI("Meas:Current?"))
Next I
SendSCPI "Output off" ' Turn off the output
ClosePort
End Sub
Private Function OpenPort()
Dim GPIB_Address As String
Dim COM_Address As String
If bGPIB Then
GPIB_Address = "5"
Else
COM_Address = "1"
End If
ErrorStatus = viOpenDefaultRM(defaultRM)
If bGPIB Then
ErrorStatus = viOpen(defaultRM, "GPIB0::" & GPIB_Address & "::INSTR", _
Else
ErrorStatus = viOpen(defaultRM, "ASRL" & COM_Address & "::INSTR", _
SendSCPI "System:Remote"
End If
CheckError "Unable to open port"
End Function
' Resource manager id for VISA GPIB
' A flag using of GPIB or RS-232
' VISA Error code
' To use RS-232, set the bGPIB to False
' Set power-on condition
' Turn on the output
' Select GPIB address between 0 to 30
' Set the number to 2 for COM2 port
' Open the VISA session
0, 1000, power_supply)
0, 1000, power_supply)
Continued on next page
129
6

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

E3634a

Table of Contents