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

60 lines
4.2 KiB
QBasic
Raw Normal View History

Attribute VB_Name = "Module2"
Option Explicit
'######################## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################################
' CreateFileObject<63><74><EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>ʵ<EFBFBD>ֶ<EFBFBD><D6B6>ַ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
Public Const PCI2312_modeRead = &H0 ' ֻ<><D6BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ
Public Const PCI2312_modeWrite = &H1 ' ֻд<D6BB>ļ<EFBFBD><C4BC><EFBFBD>ʽ
Public Const PCI2312_modeReadWrite = &H2 ' <20>ȶ<EFBFBD><C8B6><EFBFBD>д<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ
Public Const PCI2312_modeCreate = &H3 ' <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
Public Const PCI2312_typeText = &H4 ' <20><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
'######################## 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, ByRef bDOSts As Byte) As Boolean
Declare Function PCI2312_GetDeviceDI Lib "PCI2312_32" (ByVal hDevice As Long, ByRef 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.<2E><>
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_GetDeviceBar Lib "PCI2312_32" (ByVal hDevice As Long, ByRef pbPCIBar As Long) As Boolean
Declare Function PCI2312_WritePortByte Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, ByVal Value As Byte) As Boolean
Declare Function PCI2312_WritePortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long, 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 Long) As Byte
Declare Function PCI2312_ReadPortWord Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long) As Integer
Declare Function PCI2312_ReadPortULong Lib "PCI2312_32" (ByVal hDevice As Long, ByVal pPort As Long) 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