Attribute VB_Name = "A821" Option Explicit '******** Define A822 Register Address ************* Const TIMER0 = 0 ' 8254 timer/counter_0 Const TIMER1 = 1 ' 8254 timer/counter_1 Const TIMER2 = 2 ' 8254 timer/counter_2 Const TIMER_MODE = 3 ' 8254 control register Const AD_LO = 4 ' AD, Low Byte Const AD_HI = 5 ' AD, High Byte Const DA_CH0_LO = 4 ' DA, Channel 0, Low byte Const DA_CH0_HI = 5 ' DA, Channel 0, High byte Const DA_CH1_LO = 6 ' DA, Channel 1, Low byte Const DA_CH1_HI = 7 ' DA, Channel 1, High byte Const DI_LO = 6 ' DI, Low byte Const DI_HI = 7 ' DI, High byte Const DO_LO = 13 ' DO, Low byte Const DO_HI = 14 ' DO, High byte Const CLEAR_IRQ = 8 ' AD, Clear Interrupt Request Const SET_GAIN = 9 ' AD, Gain Control Const SET_CH = 10 ' AD, Multiplexer Control Const SET_MODE = &HB ' AD, Mode Control Const SOFT_TRIG = &HC ' AD, Software Trigger Control '** define AD Trigger/Transfer Mode ** Const POLLING_MODE = 1 ' Software Trig, Software Transfer (Polling) Const DMA_MODE = 2 ' Pacer Trig, DMA Transfer Const INTERRUPT_MODE = 6 ' Pacer Trig, Software/Interrupt Transfer '*** define the AD Gain Code *** Const A821_BI_1 = 0 Const A821_BI_10 = 1 Const A821_BI_100 = 2 Const A821_BI_1000 = 3 Const A821_UNI_1 = 4 Const A821_UNI_10 = 5 Const A821_UNI_100 = 6 Const A821_UNI_1000 = 7 Const A821_BI_05 = 8 Const A821_BI_5 = 9 Const A821_BI_50 = 10 Const A821_BI_500 = 11 '*** define the error number *** Const NoError = 0 Const CheckBoardError = 1 Const CheckDmaError = 2 Const CheckIrqError = 3 Const CardNumError = 4 Declare Function A821_ActiveBoard Lib "A821w31.dll" (ByVal BoardNo As Integer) As Integer Declare Function A821_Check_Address Lib "A821w31.dll" (ByVal BaseAddr As Integer) As Integer Declare Function A821_Initialize Lib "A821w31.dll" (ByVal CardNo As Integer, ByVal BaseAddr As Integer, ByVal DmaNo As Integer, ByVal IrqNo As Integer) As Integer Declare Function A821_DI Lib "A821w31.dll" () As Integer Declare Sub A821_DO Lib "A821w31.dll" (ByVal DigitOutput As Integer) Declare Sub A821_DA Lib "A821w31.dll" (ByVal Channel As Integer, ByVal data As Integer) Declare Sub A821_AD_SetChGainMode Lib "A821w31.dll" (ByVal Ch As Integer, ByVal Gain As Integer, ByVal Mode As Integer) Declare Sub A821_AD_PollingArray Lib "A821w31.dll" (Buffer As Integer, ByVal Length As Integer) Declare Function A821_AD_PollingVar Lib "A821w31.dll" () As Integer Declare Sub A821_AD_INT Lib "A821w31.dll" (ByVal Ch As Integer, ByVal Gain As Integer, ByVal count As Integer, Buffer2 As Integer, ByVal c1 As Integer, ByVal c2 As Integer) Declare Sub A821AdIntStart1 Lib "A821w31.dll" (ByVal Ch As Integer, ByVal Gain As Integer, ByVal buffersize As Integer, Buffer2 As Integer, ByVal c1 As Integer, ByVal c2 As Integer) Declare Function A821AdIntGetData Lib "A821w31.dll" (ByVal count As Integer, buf As Integer) As Integer Declare Function A821_AD_INT_Count Lib "A821w31.dll" () As Integer Declare Sub A821_AD_INT_Stop Lib "A821w31.dll" () Declare Function A821_Delay Lib "A821w31.dll" (ByVal DownCount As Integer) As Integer Declare Function DIO_InputByte Lib "A821w31.dll" (ByVal Address As Integer) As Integer Declare Sub DIO_OutputByte Lib "A821w31.dll" (ByVal Address As Integer, ByVal val As Integer)