xPCI-3001 API

Functions

_INT_ i_PCI3001_Read1AnalogInput (BYTE_ b_BoardHandle, BYTE_ b_Channel, BYTE_ b_Gain, BYTE_ b_Polarity, UINT_ ui_ConvertTiming, BYTE_ b_InterruptFlag, PUINT_ pui_AnalogInputValue)
 
_INT_ i_PCI3001_ReadMoreAnalogInput (BYTE_ b_BoardHandle, BYTE_ b_SequenzArraySize, PBYTE_ pb_ChannelArray, PBYTE_ pb_GainArray, PBYTE_ pb_PolarityArray, UINT_ ui_ConvertTiming, BYTE_ b_InterruptFlag, PUINT_ pui_AnalogInputValueArray)
 
_INT_ i_PCI3001_InitAnalogInputAcquisition (BYTE_ b_BoardHandle, BYTE_ b_SequenzArraySize, unsigned char *pb_ChannelArray, unsigned char *pb_GainArray, unsigned char *pb_PolarityArray, BYTE_ b_AcquisitionMode, BYTE_ b_ExternTrigger, UINT_ ui_AcquisitionTiming, LONG_ l_DelayTiming, ULONG_ ul_NumberOfAcquisition, BYTE_ b_DMAMode, BYTE_ b_AcquisitionCycle)
 
_INT_ i_PCI3001_StartAnalogInputAcquisition (BYTE_ b_BoardHandle)
 
_INT_ i_PCI3001_StopAnalogInputAcquisition (BYTE_ b_BoardHandle)
 
_INT_ i_PCI3001_ClearAnalogInputAcquisition (BYTE_ b_BoardHandle)
 

Detailed Description

Function Documentation

_INT_ i_PCI3001_Read1AnalogInput ( BYTE_  b_BoardHandle,
BYTE_  b_Channel,
BYTE_  b_Gain,
BYTE_  b_Polarity,
UINT_  ui_ConvertTiming,
BYTE_  b_InterruptFlag,
PUINT_  pui_AnalogInputValue 
)

Reads the current value of the analog input b_Channel with a gain b_Gain, an input voltage range of b_Polarity and a conversion time of ui_ConvertTiming

Parameters
[in]b_BoardHandle: Handle of the board PCI3001
[in]b_Channel: Number of the analog input to be read (0 to 15)
[in]b_Gain: Gain selection (PCI3001_1_GAIN, PCI3001_2_GAIN, PCI3001_5_GAIN, PCI3001_10_GAIN)
[in]b_Polarity: Selection of the input voltage range of the analog input to convert (PCI3001_UNIPOLAR, PCI3001_BIPOLAR)
[in]ui_ConvertTiming: Selection of the conversion time from 10 to 32767
[in]b_InterruptFlag:
PCI3001_ENABLE : An interrupt is generated at the end of conversion
PCI3001_DISABLE: No interrupt is generated at the end of the conversion. The analog value is in the parameter pui_AnalogInputValue.
[in]pui_AnalogInputValue: The analog value is returned (0 to 0x0FFF) (12 bits)
Returns
0: No error
-1: The handle parameter of the board is wrong
-3: The selected gain is wrong
-4: The selected input voltage range is wrong
-5: The selected conversion time is wrong
-6: A wrong parameter has been passed for b_InterruptFlag or the user interrupt routine has not been installed.
-100: Failed to get i_PCI3001_SetAnalogInputMode function from DLL
-101: Failed to get i_PCI3001_Read1AnalogInput function from DLL
-102: Failed to set analog input mode
-103: The input mode has not been set
-104: A channel index is invalid (single-ended mode)
-105: A channel index is invalid (differential mode)
-106: Error while calling IOCTL function (wrong handle ?)
_INT_ i_PCI3001_ReadMoreAnalogInput ( BYTE_  b_BoardHandle,
BYTE_  b_SequenzArraySize,
PBYTE_  pb_ChannelArray,
PBYTE_  pb_GainArray,
PBYTE_  pb_PolarityArray,
UINT_  ui_ConvertTiming,
BYTE_  b_InterruptFlag,
PUINT_  pui_AnalogInputValueArray 
)

Reads several analog inputs. The priority of the analog inputs is set with the scan list. The scan list allows to determine the input voltage range and the gain for each analog input. The gain is defined with parameter pb_Gain for each analog input. The input voltage range is defined with parameter pb_PolarityArray for each analog input.

Parameters
[in]b_BoardHandle: Handle of the board PCI3001
[in]b_SequenzArraySize: Size of the scan lists(1 up to 16 elements)
[in]pb_ChannelArray: Scan list for the analog inputs.
[in]pb_GainArray: Scan list for gain
[in]pb_PolarityArray: Scan list for the input voltage range
[in]ui_ConvertTiming: Selection of the conversion time From 10 μs up to 32767 μs.
[in]b_InterruptFlag: PCI3001_ENABLE: An interrupt is generated when the last conversion of the channel group is completed (EOS). See function "i_PCI3001_SetBoardIntRoutine". PCI3001_DISABLE: No interrupt is generated at the end of conversion. The analog values are located in parameter pui_AnalogInputValueArray.
[out]pui_AnalogInputValueArray: Input values are returned.
Returns
0: No error
-1: The handle parameter of the board is wrong
-2: The size of the scan list is wrong
-4: Wrong parameter detected in table "pb_GainArray"
-5: Wrong parameter detected in table "pb_PolarityArray"
-6: Selected conversion time is wrong
-7: Wrong parameter entered for b_InterruptFlag, or the user interrupt routine has not been installed. See function "i_PCI3001_SetBoardIntRoutineXX".
-101: i_PCI3001_ReadMoreAnalogInputs returned an error
-102: i_PCI3001_SetAnalogInputMode returned an error, SE or diff option is not actvated in the device driver
-13X: i_PCI3001_ReadMoreAnalogInputs, X correspond to the error code number of the function xPCI-3001 analogIO/i_PCI3001_ReadMoreAnalogInputs
_INT_ i_PCI3001_InitAnalogInputAcquisition ( BYTE_  b_BoardHandle,
BYTE_  b_SequenzArraySize,
unsigned char *  pb_ChannelArray,
unsigned char *  pb_GainArray,
unsigned char *  pb_PolarityArray,
BYTE_  b_AcquisitionMode,
BYTE_  b_ExternTrigger,
UINT_  ui_AcquisitionTiming,
LONG_  l_DelayTiming,
ULONG_  ul_NumberOfAcquisition,
BYTE_  b_DMAMode,
BYTE_  b_AcquisitionCycle 
)

This function initialises a cyclic conversion. The priority of the analog inputs is set through the scan list. The scan list allows to set the input voltage range and the gain for each analog input. See example 1 (pdf documentation of the old driver). The DMA option (PCI3001_DMA_USED) allows to acquire in the background analog values at high frequencies. An interrupt is generated at the end of conversion. A "2" is passed through the parameter b_InterruptMask in your interrupt routine. The DMA buffer is returned through the parameter pui_AnalogInputValue. See function "i_PCI3001_SetBoardIntRoutineXX". You have to:

  • set the priority of the analog inputs through the scan list.
  • enter the mode through the parameter b_AcquisitionMode.
  • enter the time between two conversions through the parameter ui_AcquisitionTiming.
  • enter the waiting time between two conversion cycles through the parameter l_DelayTiming, if you work in mode PCI3001_DELAY_MODUS.
  • enter the delay time between the first conversion of the first cycle and the first conversion of the next cycle through the parameter l_DelayTiming, if you work in mode PCI3001_DELAY_1_MODUS.
  • determine if you want to use DMA (parameter b_DMAUsed)
  • enter the number of acquisitions through parameter ul_NumberOfAcquisition
  • enter the DMA conversion cycle through parameter b_AcquisitionCycle, if DMA is used.
    Parameters
    [in]b_BoardHandle: Handle of the board PCI3001
    [in]b_SequenzArraySize: Size of the scan lists(1 up to 16 elements)
    [in]pb_ChannelArray: Scan list for the analog inputs.
    [in]pb_GainArray: Scan list for gain
    [in]pb_PolarityArray: Scan list for the input voltage range
    [in]b_AcquisitionMode: Two conversion cycles are possible:
    • PCI3001_SIMPLE_MODUS: A conversion occurs every ui_AcquisitionTiming (time interval) See example 2 (See pdf documentation old driver)
    • CI3001_DELAY_MODUS: Both times are used in this mode ui_AcquisitionTiming and l_DelayTiming. Conversions occur every ui_AcquisitionTiming (time interval) until all analog inputs have been acquired (determined by b_SequenzArraySize). Step 1 of example 3. Afterwards there is a waiting time of l_DelayTiming (See pdf documentation old driver) Step 2 of example 3. The two steps are repeated. See example 3(See pdf documentation old driver)
    • PCI3001_DELAY_1_MODUS: See example 4 (See pdf documentation old driver)
    [in]b_ExternTriggerTwo modes are possible :
    • PCI3001_DISABLE: the cyclic conversion is initialised after calling the function "i_PCI3001_StartAnalogInputAcquisition".
    • PCI3001_ENABLE: the cyclic conversion is initialised after the calling the function "i_PCI3001_StartAnalogInputAcquisition". A logic "1" on the digital input 1 starts the conversion. The conversion is stopped by calling "i_PCI3001_StopAnalogInputAcquisition".
    [in]ui_AcquisitionTimingTime interval in μs between 2 conversions of successive inputs. (10 μs to 32767 μs) See example 1 and 2 (See pdf documentation old driver)
    [in]l_DelayTiming: Waiting time in μs between two conversion cycles (from 100 μs to 3276750 μs) This parameter is relevant only if you use PCI3001_DELAY_MODUS or PCI3001_DELAY_1_MODUS.
    [in]ul_NumberOfAcquisition: If you use DMA, this parameter determines how many conversions have to be performed. DOS: 1 to 32767 Win32: 1 to 232 If you do not use DMA, this parameter determines how many acquisition cycles must be performed. Warning: if you work in DMA_CONTINUOUS with an acquisition time of 10 μs and under VB 5.0 the minimum value is 16.
    [in]b_DMAMode: Determines if DMA should be used or not.
    • PCI3001_DMA_USED: All conversion values are saved in the DMA buffer. An interrupt is generated, when ui_NumberOfAcquisition conversions have been completed. See function "i_PCI3001_SetBoardIntRoutineXX".
    • PCI3001_DMA_NOT_USED: An interrupt is generated when the conversion of the last channel group has been completed. The analog value is returned through the user interrupt routine. See function "i_PCI3001_SetBoardIntRoutineXX".
    [in]b_AcquisitionCycle: Determines the type of DMA conversion.
    • PCI3001_CONTINUOUS: An interrupt is generated each time a DMA conversion cycle is completed. A new DMA conversion cycle is then started.
    • PCI3001_SINGLE: The DMA conversion cycle is carried out only once: i.e. You receive one single interrupt at the end of the first DMA conversion cycle. See example 1 (See pdf documentation old driver)
    Returns
    0: No error
    -1: The handle parameter of the board is wrong
    -3: Size of the scan list is wrong
    -4: Wrong parameter detected in table "pb_ChannelArray"
    -5: Wrong parameter detected in table "pb_GainArray"
    -6: Wrong parameter detected in table "pb_PolarityArray"
    -8: The selected time for ui_AcquisitionTiming or l_DelayTiming is wrong
    -14: ul_NumberofAcquisition is wrong, sequence before interrupt and the number of channels are ok. The multiplication of the two values must be a multiple of 2 since the DMA can only transfer 32 bit values.
_INT_ i_PCI3001_StartAnalogInputAcquisition ( BYTE_  b_BoardHandle)

Starts the cyclic conversion. It has been previously initialised with function "i_PCI3001_InitAnalogInputAcquisition".

Parameters
[in]b_BoardHandle: Handle of the board PCI3001
Returns
0: No error
-1: The handle parameter of the board is wrong
-2: The size of the scan list is wrong
-3: Wrong parameter detected in table "pb_GainArray"
-100: PCI3001_SetAnalogInputMode returned an error, SE or diff option is not actvated in the device driver
-101: PCI3001_StopAnalogAcquisition returned an error
-104: Input Mode, SE or diff. option is not actvated in the device driver
-105: Wrong parameter detected in table "pb_GainArray"
-106: Wrong parameter detected in table "pb_PolarityArray
-107: The selected time for ui_AcquisitionTiming or l_DelayTiming is wrong
-108: The delaymode is not correctly defined
-109: delay time schould between 100 and 3276850
-110: delay time %50 is not a multiple of 50
-111: First delaymode, check delayMode and delayTime
-112: Delaytime schould < sequenceSize * convertionTime and delayMode == APCI3001_DELAY_1_MODUS, verify these two parameter !
-114: sequence before interrupt is < 1
-115: sequence Before Interrupt * sequensize ist not a multiple of 2
-116: External trigger is wrong
_INT_ i_PCI3001_StopAnalogInputAcquisition ( BYTE_  b_BoardHandle)

Stops the cyclic conversion. It has been started previously with function "i_PCI3001_StartAnalogInputAcquisition"

Parameters
[in]b_BoardHandle: Handle of the board
Return values
0: No Error
-1: The handle parameter of the board is wrong
-101: i_PCI3001_StopAnalogAcquisition returned an error.
_INT_ i_PCI3001_ClearAnalogInputAcquisition ( BYTE_  b_BoardHandle)

Deinstalls the DMA buffer

Parameters
[in]b_BoardHandle: Handle of the board
Return values
0: No Error
-1: The handle parameter of the board is wrong
-2: The cyclic conversion has not been initialized.