SSPC-Tester/Driver/急停报警相关资料/PCI2312 Samples/VB/Simple/PCI2312.bas

65 lines
4.4 KiB
QBasic
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Attribute VB_Name = "Module2"
Option Explicit
'######################## 常量定义 #################################
' CreateFileObject所用的文件操作方式控制字(可通过或指令实现多种方式并操作)
Public Const PCI2312_modeRead = &H0 ' 只读文件方式
Public Const PCI2312_modeWrite = &H1 ' 只写文件方式
Public Const PCI2312_modeReadWrite = &H2 ' 既读又写文件方式
Public Const PCI2312_modeCreate = &H3 ' 如果文件不存可以创建该文件如果存在则重建此文件并清0
Public Const PCI2312_typeText = &H4 ' 以文本方式操作文件
'######################## Common function ##############################
Declare Function PCI2312_CreateDevice Lib "PCI2312_32" (ByVal DeviceID As Integer) As Long ' create device object
Declare Function PCI2312_GetDeviceCount Lib "PCI2312_32" (ByVal hDevice As Long) As Integer ' get the amount of this kind of device from this system
Declare Function PCI2312_GetDeviceCurrentID Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean
Declare Function PCI2312_ListDeviceDlg Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' list all PCI devices in the system
Declare Function PCI2312_ReleaseDevice Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' reset the whole PCI device
'####################### DI/DO function #################################
'Applicable to the equipment control that is more direct and specific, low-level, more complex.
' For example, if it needs special control process and control efficiency in accordance with the special control object , users can achieve by using these interfaces.
Declare Function PCI2312_SetDeviceDO Lib "PCI2312_32" (ByVal hDevice As Long, ByVal bDOSts As Byte) As Boolean
Declare Function PCI2312_GetDeviceDI Lib "PCI2312_32" (ByVal hDevice As Long, ByVal bDISts As Byte) As Boolean
' Get on/off status
' device handle
' on/off status
'####################### The trigger interrupt function #################################
' It consists of hardware signal of the state change CPU produce interruption hEventInt.。
Declare Function PCI2312_InitDeviceInt Lib "PCI2312_32" ( _
ByVal hDevice As Long, _
ByVal hEventInt As Long) As Boolean ' initialize interruption
Declare Function PCI2312_GetDeviceIntCount Lib "PCI2312_32" (ByVal hDevice As Long) As Long ' In interrupt is initialized, using it to get the interrupt service routine produce number of times
Declare Function PCI2312_ReleaseDeviceInt Lib "PCI2312_32" (ByVal hDevice As Long) As Boolean ' Release interruption resource
' # # # # # # # # # # # # # # # # # memory mapping registers direct operation and read and write functions # # # # # # # # # # # # # # # # # # # # # # # #
' suitable for user more directly, this equipment more special, more low, and more complex control. According to the special such as
' control object need special control flow and control efficiency, the user can use these interface to achieve.
Declare Function PCI2312_GetDeviceAddr Lib "PCI2312_32" (ByVal hDevice As Long, ByRef LinearAddr As Long, ByRef PhysAddr As Long, ByVal RegisterID As Integer) As Boolean
' linearity base adress of the mapping register that has
' device object handle
' return linearity base adress
' return physics adress
' register ID(0-5)
Declare Function PCI2312_WritePortByte Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Integer, ByVal Value As Byte) As Boolean
Declare Function PCI2312_WritePortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Integer, ByVal Value As Integer) As Boolean
Declare Function PCI2312_WritePortULong Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, ByVal Value As Long) As Boolean
Declare Function PCI2312_ReadPortByte Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Integer) As Byte
Declare Function PCI2312_ReadPortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Integer) As Integer
Declare Function PCI2312_ReadPortULong Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Integer) As Long
'########################### Thread operation function ######################################
Declare Function PCI2312_CreateSystemEvent Lib "PCI2312_32" () As Long ' create the (kernel) system event object
Declare Function PCI2312_ReleaseSystemEvent Lib "PCI2312_32" (ByVal hEvent As Long) As Boolean ' release (kernel) system event object