'//-----------------------------------------------------------------------------------------
'//File Name:UniDAQ.vb
'//Update date:2014/05/14 by Dan Huang
'//Support Language: Visual Basic.NET 
'//UniDAQ SDK User Manual: http://ftp.icpdas.com/pub/cd/iocard/pci/napdos/pci/unidaq/maunal/
'//-----------------------------------------------------------------------------------------
Option Strict On
Imports System.Runtime.InteropServices

Module UniDAQ

    Public Const MAX_BOARD_NUMBER As UInt16 = 32
    Public Const MAX_EVENT_NUMBER As UInt16 = 20
    Public Const MAX_AO_CHANNEL As UInt16 = 32

    '//Option Mode
    Public Const MULTIPROCESSOR As UInt32 = 1
    Public Const ENABLEMEMIO As UInt32 = 2
    Public Const ENABLEDMAAI As Uint32 = 16

    'ModelNumber
    Public Const PIOD56 As UInt32 = &H800140
    Public Const PEXD56 As UInt32 = &H800140
    Public Const PIOD48 As UInt32 = &H800130
    Public Const PEXD48 As UInt32 = &H800130
    Public Const PIOD64 As UInt32 = &H800120
    Public Const PIOD96 As UInt32 = &H800110
    Public Const PIOD144 As UInt32 = &H800100
    Public Const PIOD168 As UInt32 = &H800150
    Public Const PIODA As UInt32 = &H800400
    Public Const PEXDA As UInt32 = &H800400
    Public Const PIO821 As UInt32 = &H800310

    Public Const PISOP16R16U As UInt32 = &H1800FF
    Public Const PEX16R16 As UInt32 = &H1800FF
    Public Const PEXP8R8 As UInt32 = &H1800FF
    Public Const PISOC64 As UInt32 = &H800800
    Public Const PEXC64 As UInt32 = &H800800
    Public Const PISOP64 As UInt32 = &H800810
    Public Const PEXP64 As UInt32 = &H800810
    Public Const PISOA64 As UInt32 = &H800850
    Public Const PISOP32C32 As UInt32 = &H800820
    Public Const PEXP32C32 As UInt32 = &H800820
    Public Const PISOP32A32 As UInt32 = &H800870
    Public Const PISOP8R8 As UInt32 = &H800830
    Public Const PISO730 As UInt32 = &H800840
    Public Const PISO730A As UInt32 = &H800880
    Public Const PISO725 As UInt32 = &H8008FF
    Public Const PISODA2 As UInt32 = &H800B00

    Public Const PISO813 As UInt32 = &H800A00

    Public Const PCITMC12 As UInt32 = &HDF2962
    Public Const PCIM512 As UInt32 = &HDE9562
    Public Const PCIM256 As UInt32 = &HDE92A6
    Public Const PCIM128 As UInt32 = &HDE9178
    Public Const PCIFC16 As UInt32 = &HB13017
    Public Const PCID64 As UInt32 = &HDE3513

    Public Const PCI822 As UInt32 = &HDE3823
    Public Const PCI826 As UInt32 = &HDE3827
    Public Const PCI2602 As UInt32 = &H2CB656

    Public Const PCI100x As UInt32 = &H341002
    Public Const PEX100x As UInt32 = &H341002
    Public Const PCI1202 As UInt32 = &H345672
    Public Const PEX1202 As UInt32 = &H345672
    Public Const PCI1602 As UInt32 = &H345676
    Public Const PCI180x As UInt32 = &H345678
    Public Const PCIP8R8 As UInt32 = &HD6102B
    Public Const PEXP8POR8 As UInt32 = &HD6102B
    Public Const PCIP16R16 As UInt32 = &HD61E39
    Public Const PEXP16POR16 As UInt32 = &HD61E39

    <StructLayout(LayoutKind.Sequential)> _
    Public Structure IXUD_DEVICE_INFO
        Public dwSize As UInt32
        Public wVendorID As UInt16
        Public wDeviceID As UInt16
        Public wSubVendorID As UInt16
        Public wSubDeviceID As UInt16
        '<VBFixedArray(5)> Public dwBAR() As UInt32
        Public dwBAR0 As UInt32
        Public dwBAR1 As UInt32
        Public dwBAR2 As UInt32
        Public dwBAR3 As UInt32
        Public dwBAR4 As UInt32
        Public dwBAR5 As UInt32
        Public BusNo As Byte
        Public DevNo As Byte
        Public IRQ As Byte
        Public Aux As Byte
        '<VBFixedArray(5)> Public dwReserved1() As UInt32   'Reserver 
        Public dwBarVirtualAddress0 As UInt32 '// PCI Bar Virtual Address Bar 0(For MMIO) 
        Public dwBarVirtualAddress1 As UInt32 '// PCI Bar Virtual Address Bar 1(For MMIO)
        Public dwBarVirtualAddress2 As UInt32 '// PCI Bar Virtual Address Bar 2(For MMIO) 
        Public dwBarVirtualAddress3 As UInt32 '// PCI Bar Virtual Address Bar 3(For MMIO) 
        Public dwBarVirtualAddress4 As UInt32 '// PCI Bar Virtual Address Bar 4(For MMIO) 
        Public dwBarVirtualAddress5 As UInt32 '// PCI Bar Virtual Address Bar 5(For MMIO) 
    End Structure

    <StructLayout(LayoutKind.Sequential)> _
    Public Structure IXUD_CARD_INFO

        Public dwSize As UInt32             'Structure size
        Public dwModelNo As UInt32          'Model Number

        'CardID is update when calling the function each time.
        Public CardID As Byte               'for new cards, 0xFF=N/A
        Public wSingleEnded As Byte         'for new cards,1:S.E 2:D.I.F,0xFF=N/A
        Public wReserved As UInt16          'Reserver

        Public wAIChannels As UInt16        'Number of AI channels(AD)
        Public wAOChannels As UInt16        'Number of AO channels(DA)

        Public wDIPorts As UInt16           'Number of DI ports
        Public wDOPorts As UInt16           'Number of DO ports

        Public wDIOPorts As UInt16          'Number of DIO ports
        Public wDIOPortWidth As UInt16      'The width is 8/16/32 bit.

        Public wCounterChannels As UInt16   'Number of Timers/Counters
        Public wMomorySize As UInt16        'PCI-M512==>512, Units in KB.
        Public dwReserved10 As UInt32       'Reserver 
        Public dwReserved11 As UInt32       'Reserver
        Public dwReserved12 As UInt32       'Reserver 
        Public dwReserved13 As UInt32       'Reserver 
        Public dwReserved14 As UInt32       'Reserver 
        Public dwReserved15 As UInt32       'Reserver

        '<VBFixedArray(5)> Public dwReserved1() As UInt32   'Reserver 
        'Sub Initialize()
        '    ReDim dwReserved1(5)
        'End Sub

    End Structure

    Public a As IXUD_DEVICE_INFO
    Public b As IXUD_CARD_INFO


    'User AI Config Code
    Public Const IXUD_BI_20V As UInt16 = 23      '//Bipolar +/- 20V
    Public Const IXUD_BI_10V As UInt16 = 0      '//Bipolar +/- 10V
    Public Const IXUD_BI_5V As UInt16 = 1       '//Bipolar +/-  5V
    Public Const IXUD_BI_2V5 As UInt16 = 2      '//Bipolar +/-  2.5V
    Public Const IXUD_BI_1V25 As UInt16 = 3     '//Bipolar +/-  1.25V
    Public Const IXUD_BI_0V625 As UInt16 = 4    '//Bipolar +/-  0.625V
    Public Const IXUD_BI_0V3125 As UInt16 = 5   '//Bipolar +/-  0.3125V
    Public Const IXUD_BI_0V5 As UInt16 = 6      '//Bipolar +/-  0.5V
    Public Const IXUD_BI_0V05 As UInt16 = 7     '//Bipolar +/-  0.05V
    Public Const IXUD_BI_0V005 As UInt16 = 8    '//Bipolar +/-  0.005V
    Public Const IXUD_BI_1V As UInt16 = 9       '//Bipolar +/-  1V
    Public Const IXUD_BI_0V1 As UInt16 = 10     '//Bipolar +/-  0.1V
    Public Const IXUD_BI_0V01 As UInt16 = 11    '//Bipolar +/-  0.01V
    Public Const IXUD_BI_0V001 As UInt16 = 12   '//Bipolar +/-  0.001V
    Public Const IXUD_UNI_20V As UInt16 = 13    '//Unipolar 0 ~ 20V
    Public Const IXUD_UNI_10V As UInt16 = 14    '//Unipolar 0 ~ 10V
    Public Const IXUD_UNI_5V As UInt16 = 15     '//Unipolar 0 ~  5V
    Public Const IXUD_UNI_2V5 As UInt16 = 16    '//Unipolar 0 ~  2.5V
    Public Const IXUD_UNI_1V25 As UInt16 = 17   '//Unipolar 0 ~  1.25V
    Public Const IXUD_UNI_0V625 As UInt16 = 18  '//Unipolar 0 ~  0.625V
    Public Const IXUD_UNI_1V As UInt16 = 19     '//Unipolar 0 ~  1V
    Public Const IXUD_UNI_0V1 As UInt16 = 20    '//Unipolar 0 ~  0.1V
    Public Const IXUD_UNI_0V01 As UInt16 = 21   '//Unipolar 0 ~  0.01V
    Public Const IXUD_UNI_0V001 As UInt16 = 22  '//Unipolar 0 ~  0.001V

    Public Const MAX_AOCFGCODE_NUMBER As UInt16 = 6 '//User definition the total number of the AO ConfigCodeTotal

    'User AO Config Code for Voltage
    Public Const IXUD_AO_UNI_5V As UInt16 = 0  '//0  ~  5V
    Public Const IXUD_AO_BI_5V As UInt16 = 1  '//+/-   5V
    Public Const IXUD_AO_UNI_10V As UInt16 = 2  '//0  ~ 10V
    Public Const IXUD_AO_BI_10V As UInt16 = 3  '//+/-  10V
    Public Const IXUD_AO_UNI_20V As UInt16 = 4  '//0  ~ 20V
    Public Const IXUD_AO_BI_20V As UInt16 = 5  '//+/-  20V

    'User AO Config Code for Current
    Public Const IXUD_AO_I_0_20_MA As UInt16 = 16  '//0 ~ 20mA
    Public Const IXUD_AO_I_4_20_MA As UInt16 = 17  '//4 ~ 20mA

    'Interrupt Setting
    Public Const IXUD_HARDWARE_INT As UInt16 = 1 '// Hardware Interrupt
    Public Const IXUD_APC_READY_INT As UInt16 = 2 '// APC Ready Interrupt
    Public Const IXUD_ACTIVE_LOW As UInt16 = 4 '// Active Low Trigger
    Public Const IXUD_ACTIVE_HIGH As UInt16 = 8 '// Active High Trigger

    '//Analog Trigger Mode Setting
    Public Const IXUD_ANALOGTRIGGER_ABOVE As UInt16 = 1 'Above high
    Public Const IXUD_ANALOGTRIGGER_BELOW As UInt16 = 2 'Below low
    Public Const IXUD_ANALOGTRIGGER_LEAVE As UInt16 = 3 'Leave region
    Public Const IXUD_ANALOGTRIGGER_ENTRY As UInt16 = 4 'Entry region

    '//Return Code
    Public Const Ixud_NoErr As UInt16 = 0 '//Correct
    Public Const Ixud_OpenDriverErr As UInt16 = 1 '//Open driver error
    Public Const Ixud_PnPDriverErr As UInt16 = 2 '//Plug & Play error
    Public Const Ixud_DriverNoOpen As UInt16 = 3 '//The driver was not open
    Public Const Ixud_GetDriverVersionErr As UInt16 = 4 '//Recieve driver version error
    Public Const Ixud_ExceedBoardNumber As UInt16 = 5 '//Board number error
    Public Const Ixud_FindBoardErr As UInt16 = 6 '//No board found
    Public Const Ixud_BoardMappingErr As UInt16 = 7 '//Board Mapping error
    Public Const Ixud_DIOModesErr As UInt16 = 8 '//Digital input/output mode setting error
    Public Const Ixud_InvalidAddress As UInt16 = 9 '//Invalid address
    Public Const Ixud_InvalidSize As UInt16 = 10 '//Invalid size
    Public Const Ixud_InvalidPortNumber As UInt16 = 11 '//Invalid port number
    Public Const Ixud_UnSupportedModel As UInt16 = 12 '//This board model is not supported
    Public Const Ixud_UnSupportedFun As UInt16 = 13 '//This function is not supported
    Public Const Ixud_InvalidChannelNumber As UInt16 = 14 '//Invalid channel number
    Public Const Ixud_InvalidValue As UInt16 = 15 '//Invalid value
    Public Const Ixud_InvalidMode As UInt16 = 16 '//Invalid mode
    Public Const Ixud_GetAIStatusTimeOut As UInt16 = 17 '//A timeout occurred while receiving the status of the analog input
    Public Const Ixud_TimeOutErr As UInt16 = 18 '//Timeout error
    Public Const Ixud_CfgCodeIndexErr As UInt16 = 19 '//A compatible configuration code table index could not be found
    Public Const Ixud_ADCCTLTimeoutErr As UInt16 = 20 '//ADC controller a timeout error
    Public Const Ixud_FindPCIIndexErr As UInt16 = 21 '//A compatible PCI table index value could not be found
    Public Const Ixud_InvalidSetting As UInt16 = 22 '//Invalid setting value
    Public Const Ixud_AllocateMemErr As UInt16 = 23 '//Error while allocating the memory space
    Public Const Ixud_InstallEventErr As UInt16 = 24 '//Error while installing the interrupt event
    Public Const Ixud_InstallIrqErr As UInt16 = 25 '//Error while installing the interrupt IRQ
    Public Const Ixud_RemoveIrqErr As UInt16 = 26 '//Error while removing the interrupt IRQ
    Public Const Ixud_ClearIntCountErr As UInt16 = 27 '//Error while the clear interrupt count
    Public Const Ixud_GetSysBufferErr As UInt16 = 28 '//Error while retrieving the system buffer
    Public Const Ixud_CreateEventErr As UInt16 = 29 '//Error while create the event
    Public Const Ixud_UnSupportedResolution As UInt16 = 30 '//Resolution not supported
    Public Const Ixud_CreateThreadErr As UInt16 = 31 '//Error while create the thread
    Public Const Ixud_ThreadTimeOutErr As UInt16 = 32 '//Thread timeout error
    Public Const Ixud_FIFOOverFlowErr As UInt16 = 33 '//FIFO overflow error
    Public Const Ixud_FIFOTimeOutErr As UInt16 = 34 '//FIFO timeout error
    Public Const Ixud_GetIntInstStatus As UInt16 = 35 '//Retrieves the status of the interrupt installation
    Public Const Ixud_GetBufStatus As UInt16 = 36 '//Retrieves the status of the system buffer
    Public Const Ixud_SetBufCountErr As UInt16 = 37 '//Error while setting the buffer count
    Public Const Ixud_SetBufInfoErr As UInt16 = 38 '//Error while setting the buffer data
    Public Const Ixud_FindCardIDErr As UInt16 = 39 '//Card ID code could not be found
    Public Const Ixud_EventThreadErr As UInt16 = 40 '//Event Thread error
    Public Const Ixud_AutoCreateEventErr As UInt16 = 41 '//Error while automatically creating an event
    Public Const Ixud_RegThreadErr As UInt16 = 42 '//Register Thread error
    Public Const Ixud_SearchEventErr As UInt16 = 43 '//Search Event error
    Public Const Ixud_FifoResetErr As UInt16 = 44 '//Error while resetting the FIFO
    Public Const Ixud_InvalidBlock As UInt16 = 45 '//Invalid EEPROM block
    Public Const Ixud_InvalidAddr As UInt16 = 46 '//Invalid EEPROM address
    Public Const Ixud_AcqireSpinLock As UInt16 = 47 '//Error while acquiring spin lock
    Public Const Ixud_ReleaseSpinLock As UInt16 = 48 '//Error while releasing spin lock
    Public Const Ixud_SetControlErr As UInt16 = 49 '//Analog input setting error
    Public Const Ixud_InvalidChannels As UInt16 = 50 '//Invalid channel number
    Public Const Ixud_SearchCardErr As UInt16 = 51 '//Invalid model number
    Public Const Ixud_SetMapAddressErr As UInt16 = 52 '//Error while setting the mapping address
    Public Const Ixud_ReleaseMapAddressErr As UInt16 = 53 '//Error while releasing the mapping address
    Public Const Ixud_InvalidOffset As UInt16 = 54 '//Invalid memory offset
    Public Const Ixud_ShareHandleErr As UInt16 = 55 '//Open the share memory fail
    Public Const Ixud_InvalidDataCount As UInt16 = 56 '//Invalid data count
    Public Const Ixud_WriteEEPErr As UInt16 = 57 '//Error while writing the EEPROM
    Public Const Ixud_CardIOErr As UInt16 = 58 '//CardIO error
    Public Const Ixud_IOErr As UInt16 = 59 '//MemoryIO error
    Public Const Ixud_SetScanChannelErr As UInt16 = 60  'MemoryIO error
    Public Const Ixud_SetScanConfigErr As UInt16 = 61 'Set channel scan number error
    Public Const Ixud_GetMMIOMapStatus As UInt16 = 62   'Set channel scan config error

    Public Delegate Sub CallBackFun(ByVal Param As UInt32)
    <DllImport("kernel32.dll")> _
        Public Sub ZeroMemory(ByVal addr As IntPtr, ByVal size As Integer)
    End Sub

    '// Driver functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetDllVersion(ByRef dwDLLver As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
      Public Function Ixud_OptionMode(ByVal dwMode As UInt32) As UInt16
    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_DriverInit(ByRef wTotalBoard As UInt16) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_DriverClose() As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetBoardNoByCardID(ByRef wBoardNo As UInt16, ByVal dwModelNumber As UInt32, ByVal wCardID As UInt16) As UInt16

    End Function
    '<DllImport("UniDAQ.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall, SetLastError:=True)> _
    'Public Function Ixud_GetCardInfo(ByVal wBoardNo As UInt16, ByVal a As IXUD_DEVICE_INFO, ByVal b As IXUD_CARD_INFO, ByVal szModelName As String) As UInt16

    'End Function

    Declare Ansi Function Ixud_GetCardInfo _
    Lib "UniDAQ.dll" (ByVal wBoardNo As UInt16, ByRef a As IXUD_DEVICE_INFO, ByRef b As IXUD_CARD_INFO, ByVal szModelName As String) As UInt16

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadPort(ByVal dwAddress As UInt32, ByVal wsize As UInt16, ByRef dwVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WritePort(ByVal dwAddress As UInt32, ByVal wsize As UInt16, ByVal dwVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadPhyMemory(ByVal dwAddress As UInt32, ByVal wSize As UInt16, ByRef dwVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WritePhyMemory(ByVal dwAddress As UInt32, ByVal wSize As UInt16, ByVal dwVal As UInt32) As UInt16

    End Function

    '//Digital I/O functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_SetDIOModes32(ByVal wBoardNo As UInt16, ByVal dwDirections As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_SetDIOMode(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal wDirection As UInt16) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadDI(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByRef dwDIVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadDIBit(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal wBitNo As UInt16, ByRef dwDIVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
        Public Function Ixud_WriteDO(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal dwDOVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
      Public Function Ixud_WriteDOBit(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal wBitNo As UInt16, ByVal dwDOVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_SoftwareReadbackDO(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByRef dwDOVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartDO(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal dwMode As UInt32, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32, ByVal dwCycleNum As UInt32, ByVal dwDOVal As UInt32()) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StopDO(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartDI(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal dwMode As UInt32, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32) As UInt16
    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StopDI(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16) As UInt16
    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetDIBufferH(ByVal wBoardNo As UInt16, ByVal wPortNo As UInt16, ByVal dwDataCount As UInt32, ByVal hValue As UInt32()) As UInt16
    End Function

    '//Callback functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_SetEventCallback(ByVal wBoardNo As UInt16, ByVal wEventType As UInt16, ByVal wIntSource As UInt16, ByRef hEvent As UInt32, ByVal CallbackFunction As CallBackFun, ByVal dwCallbackParameter As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_RemoveEventCallback(ByVal wBoardNo As UInt16, ByVal wIntSource As UInt16) As UInt16

    End Function

    '//Interrupt functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_InstallIrq(ByVal wBoardNo As UInt16, ByVal dwIntMask As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_RemoveIrq(ByVal wBoardNo As UInt16) As UInt16

    End Function

    '//Timer/Counter functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadCounter(ByVal wBoardNo As UInt16, ByVal wChannelNo As UInt16, ByRef dwVal As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_SetCounter(ByVal wBoardNo As UInt16, ByVal wChannelNo As UInt16, ByVal wMode As UInt16, ByVal dwVal As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_DisableCounter(ByVal wBoardNo As UInt16, ByVal wChannelNo As UInt16) As UInt16

    End Function

    '//Memory I/O functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadMemory(ByVal wBoardNo As UInt16, ByVal dwOffsetByte As UInt32, ByVal wSize As UInt16, ByRef dwValue As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteMemory(ByVal wBoardNo As UInt16, ByVal dwOffsetByte As UInt32, ByVal wSize As UInt16, ByVal dwValue As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadMemory32(ByVal wBoardNo As UInt16, ByVal dwOffsetByte As UInt32, ByRef dwLow As UInt32, ByRef dwHigh As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteMemory32(ByVal wBoardNo As UInt16, ByVal dwOffsetByte As UInt32, ByVal dwLow As UInt32, ByVal dwHigh As UInt32) As UInt16

    End Function

    '//Analog Input functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadAI(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByRef fValue As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ReadAIH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByRef dwValue As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ConfigAI(ByVal wBoardNo As UInt16, ByVal wFIFOSizeKB As UInt16, ByVal BufferSizeKB As UInt32, ByVal wCardType As UInt16, ByVal wDelaySettlingTime As UInt16) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ConfigAIEx(ByVal wBoardNo As UInt16, ByVal wFIFOSizeKB As UInt16, ByVal BufferSizeCount As UInt32, ByVal wCardType As UInt16, ByVal wDelaySettlingTime As UInt16, ByVal dwMode As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_PollingAI(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByVal dwDataCount As UInt32, ByVal fAIBuf() As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_PollingAIH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByVal dwDataCount As UInt32, ByVal dwAIBuf() As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_PollingAIScan(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wChannelList() As UInt16, ByVal wConfigList() As UInt16, ByVal dwDataPreChCount As UInt32, ByVal fAIScanBuf() As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_PollingAIScanH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wChannelList() As UInt16, ByVal wConfigList() As UInt16, ByVal dwDataPreChCount As UInt32, ByVal dwAIScanBuf() As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ClearAIBuffer(ByVal wBoardNo As UInt16) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetBufferStatus(ByVal wBoardNo As UInt16, ByRef wBufferStatus As UInt16, ByRef dwDataCount As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartAI(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartAIScan(ByVal wBoardNo As UInt16, ByVal wTotalChannels As UInt16, ByVal wChannelList() As UInt16, ByVal wConfigList() As UInt16, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetAIBuffer(ByVal wBoardNo As UInt16, ByVal dwDataCount As UInt32, ByVal fValue() As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_GetAIBufferH(ByVal wBoardNo As UInt16, ByVal dwDataCount As UInt32, ByVal hValue() As UInt32) As UInt16

    End Function
    
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StopAI(ByVal wBoardNo As UInt16) As UInt16

    End Function

    '//Analog Output functions
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_ConfigAO(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wCfgCode As UInt16) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteAOVoltage(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal fValue As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteAOVoltageH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal hValue As UInt16) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteAOCurrent(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal fValue As Single) As UInt16

    End Function
    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_WriteAOCurrentH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal hValue As UInt16) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartAOVoltage(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32, ByVal dwCycleNum As UInt32, ByVal fValue() As Single) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StartAOVoltageH(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16, ByVal wConfig As UInt16, ByVal fSamplingRate As Single, ByVal dwDataCount As UInt32, ByVal dwCycleNum As UInt32, ByVal dwValue() As UInt32) As UInt16

    End Function

    <DllImport("UniDAQ.dll")> _
    Public Function Ixud_StopAO(ByVal wBoardNo As UInt16, ByVal wChannel As UInt16) As UInt16

    End Function

End Module
