Application Programs 5
Example Program for Excel 97
E364xA User’s and Service Guide 151
Make any changes necessary to suit your application in the
Diode module. You must enter the information in the
modules exactly as shown or an error will be generated. If
several system errors occur while attempting to run a macro,
you may have to reboot your PC to get the GPIB or RS- 232
interface to work properly.
To use the example with Windows 3.1, you will need to modify the
declarations at the top of the module. Change visa32.dll to
visa.dll in all declarations.
Diode macro
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
' This is the subroutine first executed. Modify this routine to suit
' your needs. To change the GPIB address, go to the OpenPort module, and
' change the GPIB_Address = "5” variable to the required GPIB address.
' To change the RS-232 interface, go to the OpenPort module, and change the
' COM_Address = "1” variable to the required interface.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Global defaultRM As Long ' Resource manager id for VISA GPIB
Global power_supply As Long ' Identifies power supply
Global bGPIB As Boolean ' A flag using GPIB or RS-232
Global ErrorStatus As Long ' VISA Error code
Sub Diode_Click()
Range("B5:B15").ClearContents
Dim I As Integer
bGPIB = True ' To use RS-232, set the bGPIB to False
OpenPort
SendSCPI "*RST" ' Set power-on condition
SendSCPI "Output on" ' Turn on the output
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