Download Print this page

Agilent Technologies E3632A User Manual page 140

Dc power supply
Hide thumbs Also See for E3632A:

Advertisement

Chapter 6 Application Programs
Excel 5.0 Example for Windows 3.1 and GPIB
GPIB bas Macro
Option Explicit
' - Declarations for VISA.DLL, additional declarations are usually in the
' directory c:\vxipnp\win\include in file visa.bas, also see the VISA manual
Declare Function viOpenDefaultRM Lib "VISA.DLL" Alias "#141" (sesn As Long) As Long
Declare Function viOpen Lib "VISA.DLL" Alias "#131" (ByVal sesn As Long, _
ByVal desc As String, ByVal mode As Long, ByVal TimeOut As Long, vi As Long) As Long
Declare Function viClose Lib "VISA.DLL" Alias "#132" (ByVal vi As Long) As Long
Declare Function viRead Lib "VISA.DLL" Alias "#256" (ByVal vi As Long, _
ByVal Buffer As String, ByVal Count As Long, retCount As Long) As Long
Declare Function viWrite Lib "VISA.DLL" Alias "#257" (ByVal vi As Long, _
ByVal Buffer As String, ByVal Count As Long, retCount As Long) As Long
' Error Codes and other global variables
Global Const VI_SUCCESS = &h0&
Global videfaultRM As Long
Global vi As Long
Dim errorStatus As Long
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This routine requires the file VISA.dll. It typically resides under
' the directory c:\windows\system. This routine uses the VTL Library to
' send commands to an instrument. A description of these and additional
' VTL commands are contained in the Hewlett Packard Visa Transition
' Library book Agilent PN E2094-90002.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function SendSCPI(SCPICmd As String) As String
' This function will send a SCPI command string to the
' GPIB port. If the command contains a question mark,
' the response is read, and returned.
Dim readbuf As String * 512
Dim crlfpos As Integer
Dim cmdString As String
Dim ReturnString As String
Dim actual As Long
'Set up an error handler within this subroutine that will get
'called if an error occurs.
On Error GoTo VIerrorHandler
'Write the command to the instrument terminated by a linefeed.
cmdstring = SCPICmd & Chr$(10)
errorStatus = viWrite(vi, ByVal commandstr, Len(commandstr), actual)
' resource manager id for VISA GPIB
' stores the session for VISA
' VTL error code
' buffer used for returned string
' location of CR's and LF's in readbuf
' command passed to instrument
' string returned from instrument
' number of characters send/returned
6
137

Advertisement

loading