Chapter 6 Application Programs
Example Program for Excel 97
141
6
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 ' Resource manager id for VISA GPIB
Global power_supply As Long ' Identifies power supply
Global bGPIB As Boolean ' A flag using of 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
Private Function OpenPort()
Dim GPIB_Address As String
Dim COM_Address As String
If bGPIB Then
GPIB_Address = "5" ' Select GPIB address between 0 to 30
Else
COM_Address = "1" ' Set the number to 2 for COM2 port
End If
ErrorStatus = viOpenDefaultRM(defaultRM) ' Open the VISA session
If bGPIB Then
ErrorStatus = viOpen(defaultRM, "GPIB0::" & GPIB_Address & "::INSTR", _
0, 1000, power_supply)
Else
ErrorStatus = viOpen(defaultRM, "ASRL" & COM_Address & "::INSTR", _
0, 1000, power_supply)
SendSCPI "System:Remote"
End If
CheckError "Unable to open port"
End Function
Continued on next page
Содержание E364XA Series
Страница 9: ...8...
Страница 15: ...14 Contents Contents...
Страница 16: ...1 Quick Start...
Страница 26: ...2 General Information...
Страница 38: ...3 Front Panel Operation and Features...
Страница 70: ...4 Remote Interface Reference...
Страница 122: ...5 Error Messages...
Страница 133: ...Chapter 5 Error Messages Calibration Errors 132...
Страница 134: ...6 Application Programs...
Страница 145: ...Chapter 6 Application Programs Example Program for Excel 97 144...
Страница 146: ...7 Tutorial...
Страница 157: ...Chapter 7 Tutorial Remote Programming 156...
Страница 158: ...8 Specifications...
Страница 165: ...Chapter 8 Specifications Supplemental Characteristics 164 Figure 8 2 Dimensions for Rack mounting...
Страница 166: ...Appendix Service Information...
Страница 175: ...Appendix Service Information General Disassembly 174 General Disassembly...
Страница 207: ......
Страница 208: ......
Страница 209: ......
Страница 210: ......
Страница 211: ......
Страница 212: ......
Страница 213: ......
Страница 214: ......
Страница 215: ......
Страница 216: ......
Страница 217: ......
Страница 218: ......