'********************************************************************* ' ' IEEE 488 Library ' ' File: GPIB_vb.vb ' ' ' This file contains the Visual BASIC (32 bit) declarations for all ' GPIB library commands. ' ' '*********************************************************************** Option Strict Off Option Explicit On Module Module1 ' feature codes Public Const IEEEListener As Short = 0 Public Const IEEE488SD As Short = 1 Public Const IEEEDMA As Short = 2 Public Const IEEEFIFO As Short = 3 Public Const IEEEIOBASE As Short = 100 Public Const IEEETIMEOUT As Short = 200 Public Const IEEEINPUTEOS As Short = 201 Public Const IEEEOUTPUTEOS1 As Short = 202 Public Const IEEEOUTPUTEOS2 As Short = 203 Public Const IEEEBOARDSELECT As Short = 204 Public Const IEEEDMACHANNEL As Short = 205 ' IEEE_32M DLL routines' Declare Sub initialize Lib "IEEE_32M.DLL" Alias "_ieee_initialize@8" (ByVal addr As Integer, ByVal level As Integer) Declare Sub boardselect Lib "IEEE_32M.DLL" Alias "_ieee_boardselect@4" (ByVal bd As Integer) Declare Sub settimeout Lib "IEEE_32M.DLL" Alias "_ieee_settimeout@4" (ByVal ms As Integer) Declare Sub setoutputEOS Lib "IEEE_32M.DLL" Alias "_ieee_setoutputEOS@8" (ByVal c1 As Integer, ByVal c2 As Integer) Declare Sub setinputEOS Lib "IEEE_32M.DLL" Alias "_ieee_setinputEOS@4" (ByVal e As Integer) Declare Sub IEsend Lib "IEEE_32M.DLL" Alias "_ieee_send@16" (ByVal addr As Integer, ByVal s As String, ByVal slen As Integer, ByRef status As Integer) Declare Sub IEenter Lib "IEEE_32M.DLL" Alias "_ieee_enter@20" (ByVal r As String, ByVal maxlen As Integer, ByRef slen As Integer, ByVal addr As Integer, ByRef status As Integer) Declare Sub IEtrans Lib "IEEE_32M.DLL" Alias "_ieee_transmit@12" (ByVal cmd As String, ByVal slen As Integer, ByRef status As Integer) Declare Sub IEreceive Lib "IEEE_32M.DLL" Alias "_ieee_receive@16" (ByVal s As String, ByVal slen As Integer, ByRef llen As Integer, ByRef status As Integer) Declare Sub IEspoll Lib "IEEE_32M.DLL" Alias "_ieee_spoll@12" (ByVal addr As Integer, ByRef spoll As Integer, ByRef status As Integer) Declare Sub IEppoll Lib "IEEE_32M.DLL" Alias "_ieee_ppoll@4" (ByRef ppoll As Integer) Declare Sub IEtarray Lib "IEEE_32M.DLL" Alias "_ieee_tarray@16" (ByRef buf As Short, ByVal count As Integer, ByVal eoi As Integer, ByRef status As Integer) Declare Sub IErarray Lib "IEEE_32M.DLL" Alias "_ieee_rarray@16" (ByRef buf As Short, ByVal count As Integer, ByRef slen As Integer, ByRef status As Integer) Declare Sub setport Lib "IEEE_32M.DLL" Alias "_ieee_setport@8" (ByVal board As Integer, ByVal port As Integer) Declare Sub dmachannel Lib "IEEE_32M.DLL" Alias "_ieee_dmachannel@4" (ByVal ch As Integer) Declare Sub Enable488EX Lib "IEEE_32M.DLL" Alias "_ieee_enable_488ex@4" (ByVal en As Integer) Declare Sub Enable488SD Lib "IEEE_32M.DLL" Alias "_ieee_enable_488sd@8" (ByVal en As Integer, ByVal t As Integer) Declare Function srq Lib "IEEE_32M.DLL" Alias "_ieee_srq@0" () As Integer Declare Function ListenerPresent Lib "IEEE_32M.DLL" Alias "_ieee_listener_present@4" (ByVal addr As Integer) As Integer Declare Function GpibBoardPresent Lib "IEEE_32M.DLL" Alias "_ieee_board_present@0" () As Integer Declare Function GPIBFeature Lib "IEEE_32M.DLL" Alias "_ieee_feature@4" (ByVal f As Integer) As Integer '------------------------------------------------------- Sub enter(ByRef s As String, ByRef maxlen As Short, ByRef l As Short, ByRef addr As Short, ByRef status As Short) Dim stat As Integer Dim tmpl As Integer s = Space(maxlen) Call IEenter(s, maxlen, tmpl, addr, stat) l = tmpl s = Left(s, l) status = stat End Sub '------------------------------------------------------- Sub receive(ByRef s As String, ByRef maxlen As Short, ByRef l As Short, ByRef status As Short) Dim stat As Integer Dim tmpl As Integer s = Space(maxlen) Call IEreceive(s, maxlen, tmpl, stat) l = tmpl s = Left(s, l) status = stat End Sub '------------------------------------------------------- Sub send(ByRef addr As Short, ByRef s As String, ByRef status As Short) Dim stat As Integer Call IEsend(addr, s, -1, stat) status = stat End Sub '------------------------------------------------------- Sub transmit(ByRef cmd As String, ByRef status As Short) Dim stat As Integer Call IEtrans(cmd, -1, stat) status = stat End Sub '------------------------------------------------------- Sub spoll(ByVal addr As Short, ByRef poll As Short, ByRef status As Short) Dim stat As Integer Dim spl As Integer Call IEspoll(addr, spl, stat) poll = spl status = stat End Sub '------------------------------------------------------- Sub ppoll(ByRef poll As Short) Dim ppl As Integer Call IEppoll(ppl) poll = ppl End Sub '------------------------------------------------------- Sub tarray(ByRef buf As Object, ByVal count As Integer, ByVal eoi As Short, ByRef status As Short) Dim xx As Object Dim yy As Object Dim tmpbuf(32767) As Short 'local integer buffer Dim stat As Integer If (count And 1) = 0 Then yy = count / 2 Else yy = count / 2 + 1 End If For xx = 1 To yy tmpbuf(xx) = buf(xx) : Next xx Call IEtarray(tmpbuf(0), count, eoi, stat) status = stat End Sub '------------------------------------------------------- Sub rarray(ByRef buf As Object, ByVal count As Integer, ByRef l As Short, ByRef status As Short) Dim xx As Object Dim yy As Object Dim tmpbuf(32767) As Short 'local integer buffer Dim stat As Integer Dim tmpl As Integer Call IErarray(tmpbuf(0), count, tmpl, stat) l = tmpl status = stat If (l And 1) = 0 Then yy = l / 2 Else yy = l / 2 + 1 End If For xx = 1 To yy buf(xx) = tmpbuf(xx) : Next xx End Sub End Module