⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sicl32.bas

📁 vb,Agilent sicl control class library.
💻 BAS
📖 第 1 页 / 共 5 页
字号:
  filler As Long
  intftype As Long
  location As Long
  busaddr As Long
  hwarg(0 To 15) As String * 20
  visaname As String * 32
  filler2(0 To 3) As Long
End Type

Type vxiinfo
  laddr As Integer
  name As String * 16
  manuf_name As String * 16
  model_name As String * 16
  man_id As Long
  model As Long
  devclass As Long
  selftest As Integer
  cage_num As Integer
  slot As Integer
  protocol As Long
  x_protocol As Long
  servant_area As Long
  addrspace As Long
  memsize As Long
  memstart As Long
  slot0_laddr As Integer
  cmdr_laddr As Integer
  int_handler(0 To 7)  As Integer
  interrupter(0 To 7) As Integer
  fill(0 To 9) As Integer
End Type

Type usbinfo
    bLength As Byte
    bDescriptorType As Byte
    bcdUSB As Integer
    bDeviceClass As Byte
    bDeviceSubClass As Byte
    bDeviceProtocol As Byte
    bMaxPacketSize0 As Byte
    idVendor As Integer
    idProduct As Integer
    bcdDevice As Integer
    iManufacturer As Byte
    iproduct As Byte
    iserialNumber As Byte
    bNumconfigurations As Byte
    interfaceNumber As Byte
    manufNameStr As String * 128
    productNameStr As String * 128
    serialNumberStr As String * 128
End Type

Type usbcapinfo
   status As Byte
   reserved1 As Byte
   bcdUSBTMC As Integer
   intfCapabilities As Byte
   devCapabilities As Byte
   reservedTMC(0 To 5) As Byte
   bcdUSB488 As Integer
   intf488Capabilities As Byte
   dev488Capabilities As Byte
   reservedSUB(0 To 7) As Byte
End Type

' Masks for usbcapinfo intfCapabilities
Global Const I_USB_INTFCAP_LISTENONLY_MASK = &H1
Global Const I_USB_INTFCAP_TALKONLY_MASK = &H2
Global Const I_USB_INTFCAP_IPULSE_MASK = &H4

' Mask for usbcapinfo devCapabilities
Global Const I_USB_DEVCAP_BULK_IN_MASK = &H1

' Masks for usbcapinfo intf488Capabilities
Global Const I_USB_INTF488CAP_TRIG_MASK = &H1
Global Const I_USB_INTF488CAP_REN_MASK = &H2
Global Const I_USB_INTF488CAP_4882_MASK = &H4

' Mask for usbcapinfo dev488Capabilities
Global Const I_USB_DEV488CAP_DT1_MASK = &H1
Global Const I_USB_DEV488CAP_RL1_MASK = &H2
Global Const I_USB_DEV488CAP_SR1_MASK = &H4
Global Const I_USB_DEV488CAP_SCPI_MASK = &H8

' Version Information

Declare Function vb_iversion Lib "vbsicl32.dll" (specversion As Integer, implversion As Integer) As Integer
Declare Function vb_idrvrversion Lib "vbsicl32.dll" (ByVal id As Integer, specversion As Integer, implversion As Integer) As Integer

' Open/Close
Declare Function vb_iopen Lib "vbsicl32.dll" (ByVal addr As String) As Integer
Declare Function vb_iclose Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_igetintfsess Lib "vbsicl32.dll" (ByVal id As Integer) As Integer

' Write/Read

Declare Function vb_iwrite Lib "vbsicl32.dll" (ByVal which As Integer, ByVal id As Integer, ByVal buf As Variant, ByVal datalen As Long, ByVal endi As Integer, actual As Long) As Integer
Declare Function vb_iread Lib "vbsicl32.dll" (ByVal which As Integer, ByVal id As Integer, buf As Variant, ByVal bufsize As Long, reason As Integer, actual As Long) As Integer
Declare Function vb_itermchr Lib "vbsicl32.dll" (ByVal id As Integer, ByVal tchr As Integer) As Integer
Declare Function vb_igettermchr Lib "vbsicl32.dll" (ByVal id As Integer, tchr As Integer) As Integer

' Formatted I/O
Declare Function vb_iscan Lib "vbsicl32.dll" (ByVal which As Integer, ByVal id As Integer, ByVal s As String, ByVal fmt As String, ByRef va1 As Variant, ByRef va2 As Variant, ByRef va3 As Variant, ByRef va4 As Variant, ByRef va5 As Variant, ByRef va6 As Variant, ByRef va7 As Variant, ByRef va8 As Variant, ByRef va9 As Variant, ByRef va10 As Variant) As Integer
Declare Function vb_iprint Lib "vbsicl32.dll" (ByVal which As Integer, ByVal id As Integer, ByVal s As String, ByVal fmt As String, ByRef ap() As Variant) As Integer

Declare Function vb_ivprintf Lib "vbsicl32.dll" (ByVal id As Integer, ByVal fmt As String, ByVal ap As Variant, ByVal lenBstr As Long) As Integer
Declare Function vb_ivscanf Lib "vbsicl32.dll" (ByVal id As Integer, ByVal fmt As String, ByRef ap As Variant, ByVal lenBstr As Long) As Integer
Declare Function vb_iflush Lib "vbsicl32.dll" (ByVal id As Integer, ByVal mask As Integer) As Integer
Declare Function vb_isetbuf Lib "vbsicl32.dll" (ByVal id As Integer, ByVal mask As Integer, ByVal size As Integer) As Integer

' Device/Interface Control
Declare Function vb_iclear Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_ilocal Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_iremote Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_ireadstb Lib "vbsicl32.dll" (ByVal id As Integer, ByRef stb As Integer) As Integer
Declare Function vb_itrigger Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_ixtrig Lib "vbsicl32.dll" (ByVal id As Integer, ByVal which As Long) As Integer
Declare Function vb_ihint Lib "vbsicl32.dll" (ByVal id As Integer, ByVal hint As Integer) As Integer

' Commander Sessions
Declare Function vb_isetstb Lib "vbsicl32.dll" (ByVal id As Integer, ByVal stb As Byte) As Integer

' Locking
Declare Function vb_ilock Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_iunlock Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_isetlockwait Lib "vbsicl32.dll" (ByVal id As Integer, ByVal flag As Integer) As Integer
Declare Function vb_igetlockwait Lib "vbsicl32.dll" (ByVal id As Integer, flag As Integer) As Integer

' Timeouts
Declare Function vb_itimeout Lib "vbsicl32.dll" (ByVal id As Integer, ByVal tval As Long) As Integer
Declare Function vb_igettimeout Lib "vbsicl32.dll" (ByVal id As Integer, tval As Long) As Integer

' Misc routines
Declare Function vb_igetaddr Lib "vbsicl32.dll" (ByVal id As Integer, ByVal addr As String) As Integer
Declare Function vb_igetintftype Lib "vbsicl32.dll" (ByVal id As Integer, pdata As Integer) As Integer
Declare Function vb_igetsesstype Lib "vbsicl32.dll" (ByVal id As Integer, pdata As Integer) As Integer
Declare Function vb_igetdevaddr Lib "vbsicl32.dll" (ByVal id As Integer, prim As Integer, sec As Integer) As Integer
Declare Function vb_igetlu Lib "vbsicl32.dll" (ByVal id As Integer, lu As Integer) As Integer
Declare Function vb_iswap Lib "vbsicl32.dll" (ByRef addr As Variant, ByVal length As Long, ByVal datasize As Integer) As Integer
Declare Function vb_igetlulist Lib "vbsicl32.dll" (list() As Integer) As Integer
Declare Function vb_igetluinfo Lib "vbsicl32.dll" (ByVal lu As Integer, result As lu_info) As Integer
Declare Function vb_igetgatewaytype Lib "vbsicl32.dll" (ByVal id As Integer, pdata As Integer) As Integer


' Error Handling
Declare Function vb_igeterrno Lib "vbsicl32.dll" () As Integer
Declare Function vb_iseterrno Lib "vbsicl32.dll" (ByVal id As Integer, ByVal xint As Integer) As Integer
Declare Function vb_igeterrstr Lib "vbsicl32.dll" (ByVal errcode As Integer, ByVal myerrstr As String) As Integer
Declare Function vb_icauseerr Lib "vbsicl32.dll" (ByVal id As Integer, ByVal errcode As Integer, ByVal flag As Integer) As Integer
Declare Function vbsetsiclerrbase Lib "vbsicl32.dll" (ByVal errbase As Integer) As Integer

' RS-232 specific routines
Declare Function vb_iserialmclctrl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal sline As Integer, ByVal state As Integer) As Integer
Declare Function vb_iserialmclstat Lib "vbsicl32.dll" (ByVal id As Integer, ByVal sline As Integer, state As Integer) As Integer
Declare Function vb_iserialctrl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, ByVal setting As Long) As Integer
Declare Function vb_iserialstat Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, result As Long) As Integer
Declare Function vb_iserialbreak Lib "vbsicl32.dll" (ByVal id As Integer) As Integer

' VXI Specific routines
Declare Function vb_ivxibusstatus Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, result As Long) As Integer
Declare Function vb_ivxiwaitnormop Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_ivxitrigon Lib "vbsicl32.dll" (ByVal id As Integer, ByVal which As Long) As Integer
Declare Function vb_ivxitrigoff Lib "vbsicl32.dll" (ByVal id As Integer, ByVal which As Long) As Integer
Declare Function vb_ivxitrigroute Lib "vbsicl32.dll" (ByVal id As Integer, ByVal in_which As Long, ByVal out_which As Long) As Integer
Declare Function vb_ivxigettrigroute Lib "vbsicl32.dll" (ByVal id As Integer, ByVal which As Long, route As Long) As Integer
Declare Function vb_ivxiws Lib "vbsicl32.dll" (ByVal id As Integer, ByVal wscmd As Integer, wsresp As Integer, rpe As Integer) As Integer
Declare Function vb_ivxiservants Lib "vbsicl32.dll" (ByVal id As Integer, ByVal maxnum As Integer, list() As Integer) As Integer
Declare Function vb_ivxirminfo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal laddr As Integer, ByRef info As vxiinfo) As Integer

' USB Specific Details
Declare Function vb_iusbcontrolout Lib "vbsicl32.dll" (ByVal id As Integer, ByVal bmRequestType As Integer, ByVal bRequest As Integer, ByVal wValue As Integer, ByVal wIndex As Integer, ByVal wLength As Integer, ByVal buf As String) As Integer
Declare Function vb_iusbcontrolin Lib "vbsicl32.dll" (ByVal id As Integer, ByVal bmRequestType As Integer, ByVal bRequest As Integer, ByVal wValue As Integer, ByVal wIndex As Integer, ByVal wLength As Integer, ByVal buf As String, retcnt As Integer) As Integer
Declare Function vb_iusbgetcapabilities Lib "vbsicl32.dll" (ByVal id As Integer, ByRef capinfo As usbcapinfo) As Integer
Declare Function vb_iusbgetinfo Lib "vbsicl32.dll" (ByVal id As Integer, ByRef info As usbinfo) As Integer
Declare Function vb_iusbctrl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, ByVal setting As Long) As Integer
Declare Function vb_iusbstat Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, result As Long) As Integer

' GP-IB Specific Details
Declare Function vb_igpibbusstatus Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, result As Integer) As Integer
Declare Function vb_igpibppoll Lib "vbsicl32.dll" (ByVal id As Integer, result As Integer) As Integer
Declare Function vb_igpibppollconfig Lib "vbsicl32.dll" (ByVal id As Integer, ByVal cval As Integer) As Integer
Declare Function vb_igpibppollresp Lib "vbsicl32.dll" (ByVal id As Integer, ByVal sval As Integer) As Integer
Declare Function vb_igpibpassctl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal busaddr As Integer) As Integer
Declare Function vb_igpibrenctl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal ren As Integer) As Integer
Declare Function vb_igpibatnctl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal atnval As Integer) As Integer
Declare Function vb_igpibsendcmd Lib "vbsicl32.dll" (ByVal id As Integer, ByVal buf As String, ByVal length As Integer) As Integer
Declare Function vb_igpibllo Lib "vbsicl32.dll" (ByVal id As Integer) As Integer
Declare Function vb_igpibbusaddr Lib "vbsicl32.dll" (ByVal id As Integer, ByVal busaddr As Integer) As Integer
Declare Function vb_igpibgett1delay Lib "vbsicl32.dll" (ByVal id As Integer, delay As Integer) As Integer
Declare Function vb_igpibsett1delay Lib "vbsicl32.dll" (ByVal id As Integer, ByVal delay As Integer) As Integer
Declare Function vb_igpibpulseifc Lib "vbsicl32.dll" (ByVal id As Integer) As Integer

' GPIO Specific routines
Declare Function vb_igpioctrl Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, ByVal setting As Long) As Integer
Declare Function vb_igpiostat Lib "vbsicl32.dll" (ByVal id As Integer, ByVal request As Integer, ByRef result As Long) As Integer
Declare Function vb_igpiosetwidth Lib "vbsicl32.dll" (ByVal id As Integer, ByVal dwidth As Integer) As Integer
Declare Function vb_igpiogetwidth Lib "vbsicl32.dll" (ByVal id As Integer, ByRef dwidth As Integer) As Integer

' LAN Specific functions
Declare Function vb_ilantimeout Lib "vbsicl32.dll" (ByVal id As Integer, ByVal tval As Long) As Integer
Declare Function vb_ilangettimeout Lib "vbsicl32.dll" (ByVal id As Integer, tval As Long) As Integer

' Map routines
Declare Function vb_imap Lib "vbsicl32.dll" (ByVal id As Integer, ByVal mapspace As Integer, ByVal pagestart As Integer, ByVal pagecnt As Integer, ByVal suggested As Long) As Long
Declare Function vb_iunmap Lib "vbsicl32.dll" (ByVal id As Integer, ByVal addr As Long, ByVal mapspace As Integer, ByVal pagestart As Integer, ByVal pagecnt As Integer) As Integer
Declare Function vb_imapx Lib "vbsicl32.dll" (ByVal id As Integer, ByVal mapspace As Integer, ByVal pagestart As Integer, ByVal pagecnt As Integer) As Long
Declare Function vb_iunmapx Lib "vbsicl32.dll" (ByVal id As Integer, ByVal addr As Long, ByVal mapspace As Integer, ByVal pagestart As Integer, ByVal pagecnt As Integer) As Integer
Declare Function vb_imapinfo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal mapspace As Integer, numwindows As Integer, winsize As Integer) As Integer

' peekx/pokex/blockmovex routines
Declare Function vb_ipokex8 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, ByVal value As Byte) As Integer
Declare Function vb_ipokex16 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, ByVal value As Integer) As Integer
Declare Function vb_ipokex32 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, ByVal value As Long) As Integer
Declare Function vb_ipeekx8 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, value As Byte) As Integer
Declare Function vb_ipeekx16 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, value As Integer) As Integer
Declare Function vb_ipeekx32 Lib "vbsicl32.dll" (ByVal id As Integer, ByVal handle As Long, ByVal offset As Long, value As Long) As Integer
Declare Function vb_iblockmovex Lib "vbsicl32.dll" (ByVal id As Integer, ByVal srcHandle As Long, ByRef srcOffset As Variant, ByVal srcWidth As Integer, ByVal srcIncrement As Integer, ByVal destHandle As Long, ByRef destOffset As Variant, ByVal destWidth As Integer, ByVal destIncrement As Integer, ByVal count As Long, ByVal swap As Integer) As Integer

' Block copy and fifo routines
Declare Function vb_ibblockcopy Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal dest As Long, ByVal cnt As Long) As Integer
Declare Function vb_iwblockcopy Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal dest As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_ilblockcopy Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal dest As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_ibpushfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal fifo As Long, ByVal cnt As Long) As Integer
Declare Function vb_iwpushfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal fifo As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_ilpushfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal src As Long, ByVal fifo As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_ibpopfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal fifo As Long, ByVal dest As Long, ByVal cnt As Long) As Integer
Declare Function vb_iwpopfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal fifo As Long, ByVal dest As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_ilpopfifo Lib "vbsicl32.dll" (ByVal id As Integer, ByVal fifo As Long, ByVal dest As Long, ByVal cnt As Long, ByVal swap As Integer) As Integer
Declare Function vb_icmd Lib "vbsicl32.dll" (ByVal id As Integer, ByVal cmd As Long, ByVal datalen As Integer, ByVal datawidth As Integer, ByRef pdata As Long) As Integer

' Windows 3.1 Cleanup routines
Declare Function vb__siclcleanup Lib "vbsicl32.dll" () As Integer

' Windows 3.1 yield control routine
Declare Function vb__setsiclyield Lib "vbsicl32.dll" (ByVal yield_option As Integer) As Integer

' Peek/Poke routines
Declare Sub vb_ibpoke Lib "vbsicl32.dll" (ByVal addr As Long, ByVal value As Byte)
Declare Sub vb_iwpoke Lib "vbsicl32.dll" (ByVal addr As Long, ByVal value As Integer)
Declare Sub vb_ilpoke Lib "vbsicl32.dll" (ByVal addr As Long, ByVal value As Long)
Declare Function vb_ibpeek Lib "vbsicl32.dll" (ByVal addr As Long) As Byte
Declare Function vb_iwpeek Lib "vbsicl32.dll" (ByVal addr As Long) As Integer
Declare Function vb_ilpeek Lib "vbsicl32.dll" (ByVal addr As Long) As Long

Function iversion(specversion As Integer, implversion As Integer) As Integer
    Dim id As Integer
    Dim thisErrno As Integer
    Dim myerrstr As String * 60
    Dim tmp As Integer

    ' Call the function in the SICL DLL and check for errors
    id = vb_iversion(specversion, implversion)
    iversion = id
    If id <> 0 Then
        thisErrno = vb_igeterrno()
        If thisErrno <> 0 Then
            Err.Clear    ' set default values in the error object
            ' set the error string and raise the error
            tmp = vb_igeterrstr(thisErrno, myerrstr)
            Err.Description = myerrstr
            Err.Raise (thisErrno) 'Raise the error
        End If
    End If

End Function

Function idrvrversion(id1 As Integer, specversion As Integer, implversion As Integer) As Integer
    Dim id As Integer
    Dim thisErrno As Integer
    Dim myerrstr As String * 60
    Dim tmp As Integer

    ' Call the function in the SICL DLL and check for errors
    id = vb_idrvrversion(id1, specversion, implversion)
    idrvrversion = id
    If id <> 0 Then
        thisErrno = vb_igeterrno()
        If thisErrno <> 0 Then
            Err.Clear    ' set default values in the error object
            ' set the error string and raise the error
            tmp = vb_igeterrstr(thisErrno, myerrstr)
            Err.Description = myerrstr
            Err.Raise (thisErrno) 'Raise the error
        End If
    End If

End Function

Function iopen(siclAddr As String) As Integer
    Dim id As Integer
    Dim thisErrno As Integer
    Dim myerrstr As String * 60
    Dim tmp As Integer

    ' Call the function in the SICL DLL and check for errors
    id = vb_iopen(siclAddr)
    iopen = id

    ' If we get 0 back, there was an error, try to report it
    If id = 0 Then
        thisErrno = vb_igeterrno()
        If thisErrno <> 0 Then
            Err.Clear    ' set default values in the error object
            ' set the error string and raise the error
            tmp = vb_igeterrstr(thisErrno, myerrstr)
            Err.Description = myerrstr
            Err.Raise (thisErrno) 'Raise the error
        End If
    End If

End Function



Function iclose(ByVal id1 As Integer) As Integer
    Dim id As Integer
    Dim thisErrno As Integer
    Dim myerrstr As String * 60
    Dim tmp As Integer

    ' Call the function in the SICL DLL and check for errors
    id = vb_iclose(id1)
    iclose = id
    
    ' If return value was not 0, we had an error
    If id <> 0 Then
        thisErrno = vb_igeterrno()
        If thisErrno <> 0 Then
            Err.Clear    ' set default values in the error object
            ' set the error string and raise the error
            tmp = vb_igeterrstr(thisErrno, myerrstr)
            Err.Description = myerrstr
            Err.Raise (thisErrno) 'Raise the error
        End If
    End If

End Function


Function igetintfsess(ByVal id1 As Integer) As Integer
    Dim id As Integer
    Dim thisErrno As Integer
    Dim myerrstr As String * 60
    Dim tmp As Integer

    ' Call the function in the SICL DLL and check for errors
    id = vb_igetintfsess(id1)
    igetintfsess = id

    ' If we get 0 back, there was an error, try to report it
    If id = 0 Then
        thisErrno = vb_igeterrno()
        If thisErrno <> 0 Then
            Err.Clear    ' set default values in the error object
            ' set the error string and raise the error
            tmp = vb_igeterrstr(thisErrno, myerrstr)
            Err.Description = myerrstr
            Err.Raise (thisErrno) 'Raise the error
        End If
    End If

End Function

Function iwrite(ByVal id1 As Integer, ByVal buf As Variant, ByVal datalen As Long, ByVal endi As Integer, actual As Long) As Integer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -