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

📄 a823.bas

📁 工控硬件读写ISA多功能卡823的VB例子程序
💻 BAS
字号:
Attribute VB_Name = "A823"
'*********************************************************************************
'      The Declare of A823.DLL for A823 DAQ Card
'*********************************************************************************

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'***************** DEFINE A823 RELATIVE ADDRESS *****************/
Global Const A823_TIMER0 = &H0
Global Const A823_Timer1 = &H1
Global Const A823_TIMER2 = &H2
Global Const A823_TIMER_MODE = &H3
Global Const A823_AD_LO = &H4             '* Analog to Digital, Low Byte */
Global Const A823_AD_HI = &H5             '* Analog to Digital, High Byte */
Global Const A823_DA_CH0_LO = &H4         '* Digit to Analog, CH 0 */
Global Const A823_DA_CH0_HI = &H5
Global Const A823_DA_CH1_LO = &H6         '* Digit to Analog, CH 1 */
Global Const A823_DA_CH1_HI = &H7
Global Const A823_DI_LO = &H6             '* Digit Input */
Global Const A823_DO_LO = &HD             '* Digit Output */

Global Const A823_CLEAR_IRQ = &H8
Global Const A823_SET_GAIN = &H9
Global Const A823_SET_CH = &HA
Global Const A823_SET_MODE = &HB
Global Const A823_SOFT_TRIG = &HC

Global Const A823_POLLING_MODE = 1
Global Const A823_DMA_MODE = 2
Global Const A823_INTERRUPT_MODE = 6

'*** define the gain mode ***/
Global Const A823_BI_1 = 0
Global Const A823_BI_10 = 1
Global Const A823_BI_100 = 2
Global Const A823_BI_1000 = 3
Global Const A823_UNI_1 = 4
Global Const A823_UNI_10 = 5
Global Const A823_UNI_100 = 6
Global Const A823_UNI_1000 = 7
Global Const A823_BI_05 = 8
Global Const A823_BI_5 = 9
Global Const A823_BI_50 = 10
Global Const A823_BI_500 = 11

Global Const A823_BI_2 = 1
Global Const A823_BI_4 = 2
Global Const A823_BI_8 = 3
Global Const A823_UNI_2 = 5
Global Const A823_UNI_4 = 6
Global Const A823_UNI_8 = 7

Global Const A823PGL = 0
Global Const A823PGH = 1

Global Const A823_NoError = 0
Global Const A823_DriverOpenError = 1
Global Const A823_DriverNoOpen = 2
Global Const A823_GetDriverVersionError = 3
Global Const A823_InstallIrqError = 4
Global Const A823_ClearIntCountError = 5
Global Const A823_GetIntCountError = 6
Global Const A823_GetBufferError = 7
Global Const A823_InstallBufError = 10
Global Const A823_AllocateMemoryError = 11
Global Const A823_CardTypeError = 12
Global Const A823_TimeoutError = 13
Global Const A823_OtherError = 14
Global Const A823_ExceedBoardNumber = 15
Global Const A823_CardNotFound = 16
Global Const A823_GetTotalBoardError = 17
Global Const A823_ChannelNoError = 18
Global Const A823_IntStopError = 19
Global Const A823_IntInstallEventError = 20
Global Const A823_GetConfigError = 21
Global Const A823_ActiveBoardError = 22
Global Const A823_ConfigCodeError = 23
Global Const A823_BufferFull = 24
Global Const A823_NoChannelToScan = 25
Global Const A823_IntInstallChannelError = 26
Global Const A823_IntInstallConfigError = 27

'******* Test Functions ***********
Declare Function A823_SHORT_SUB_2 Lib "A823.DLL" _
        (ByVal nA As Integer, ByVal nB As Integer) As Integer
Declare Function A823_FLOAT_SUB_2 Lib "A823.DLL" _
        (ByVal fA As Single, ByVal fB As Single) As Single
Declare Function A823_Get_DLL_Version Lib "A823.DLL" () As Integer
Declare Function A823_GetDriverVersion Lib "A823.DLL" _
        (wDriverVersion As Integer) As Integer

'******* DI/DO Functions ***********
Declare Function A823_DI Lib "A823.DLL" _
        (wInVal As Integer) As Integer
Declare Function A823_DO Lib "A823.DLL" _
        (ByVal wHexValue As Integer) As Integer

'******* AD/DA Functions ***********
Declare Function A823_SetChGain Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal wConfig As Integer, _
        ByVal wCardType As Integer) As Integer
Declare Function A823_Fast_AD_Hex Lib "A823.DLL" _
        (wVal As Integer) As Integer
Declare Function A823_Fast_AD_Float Lib "A823.DLL" _
        (fVal As Single) As Integer
Declare Function A823_AD_Hex Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal wConfig As Integer, _
        ByVal wCardType As Integer, wVal As Integer) As Integer
Declare Function A823_AD_Float Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal wConfig As Integer, _
        ByVal wCardType As Integer, fVal As Single) As Integer
Declare Function A823_ADs_Hex Lib "A823.DLL" _
        (wBuf As Integer, ByVal wCount As Integer) As Integer
Declare Function A823_ADs_Float Lib "A823.DLL" _
        (fbuf As Single, ByVal wCount As Integer) As Integer
Declare Function A823_Hex2Float Lib "A823.DLL" _
        (ByVal wConfig As Integer, ByVal wCardType As Integer, _
        ByVal wVal As Integer, fVal As Single) As Integer
                 
Declare Function A823_DA_Hex Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal wHexValue As Integer) As Integer
Declare Function A823_DA_Uni5 Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal fValue As Single) As Integer
Declare Function A823_DA_Uni10 Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal fValue As Single) As Integer
Declare Function A823_DA_Bi5 Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal fValue As Single) As Integer
Declare Function A823_DA_Bi10 Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal fValue As Single) As Integer


'******* Driver Functions ***********
Declare Function A823_DriverInit Lib "A823.DLL" _
        (wTotalBoards As Integer) As Integer
Declare Sub A823_DriverClose Lib "A823.DLL" ()
Declare Function A823_DELAY Lib "A823.DLL" _
        (ByVal wDownCount As Integer) As Integer
Declare Function A823_Check_Address Lib "A823.DLL" () As Integer
Declare Function A823_GetConfigAddress Lib "A823.DLL" _
        (wAddrBase As Integer, wCurrentBoard As Integer) As Integer
Declare Function A823_ActiveBoard Lib "A823.DLL" _
        (ByVal wBoardNo As Integer) As Integer

Declare Sub A823_OutputByte Lib "A823.DLL" _
        (ByVal wPortAddr As Integer, ByVal bOutputVal As Byte)
Declare Sub A823_OutputWord Lib "A823.DLL" _
        (ByVal wPortAddr As Integer, ByVal wOutputVal As Integer)
Declare Function A823_InputByte Lib "A823.DLL" _
        (ByVal wPortAddr As Integer) As Integer
Declare Function A823_InputWord Lib "A823.DLL" _
        (ByVal wPortAddr As Integer) As Integer


'******* IRQ Functions ***********
Declare Sub A823_SetTriggerMode Lib "A823.DLL" _
        (ByVal wTriggerMode As Integer)
Declare Function A823_Int_Install Lib "A823.DLL" _
        (hEvent As Long, ByVal dwCount As Integer) As Integer
Declare Function A823_Int_Start Lib "A823.DLL" _
        (ByVal c2 As Integer) As Integer
Declare Function A823_Int_Stop Lib "A823.DLL" () As Integer
Declare Function A823_Int_Remove Lib "A823.DLL" () As Integer
Declare Function A823_Int_GetCount Lib "A823.DLL" _
        (dwVal As Long) As Integer
Declare Function A823_Int_GetHexBuf Lib "A823.DLL" _
        (wBuffer As Integer, ByVal dwNum As Long) As Integer
Declare Function A823_Int_GetFloatBuf Lib "A823.DLL" _
        (fbuffer As Single, ByVal dwNum As Integer) As Integer

' Functions of Channel Scan
Declare Sub A823_ChScan_Clear Lib "A823.DLL" ()
Declare Function A823_ChScan_Add Lib "A823.DLL" _
        (ByVal wChannel As Integer, ByVal wConfig As Integer) _
        As Integer
Declare Function A823_ChScan_PollingHex Lib "A823.DLL" _
        (ByVal wCardType As Integer, wBuf as Integer, _
        ByVal wNumPerCh As Integer) As Integer
Declare Function A823_ChScan_PollingFloat Lib "A823.DLL" _ 
        (ByVal wCardType As Integer, fBuf as Single, _
        ByVal wNumPerCh As Integer) As Integer

' Functions of Channel Scan for Interrupt Only
Declare Function A823_ChScan_IntInstall Lib "A823.DLL" _
        (hEvent As Long, ByVal dwNumPerCh as Long) As Integer
Declare Function A823_ChScan_IntStart Lib "A823.DLL" _
        (ByVal c2 As Integer, _
        ByVal wCardType As Integer) As Integer
Declare Function A823_ChScan_IntGetCount Lib "A823.DLL" _
        (dwVal As Long) As Integer
Declare Function A823_ChScan_IntGetHexBuf Lib "A823.DLL" _
        (wBuf As Integer) As Integer
Declare Function A823_ChScan_IntGetFloatBuf Lib "A823.DLL" _
        (fBuf As Single) As Integer
Declare Function A823_ChScan_IntStop Lib "A823.DLL" () As Integer
Declare Function A823_ChScan_IntRemove Lib "A823.DLL" () As Integer

⌨️ 快捷键说明

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