xPCI-3120 API
|
Functions | |
_INT_ | i_PCI3120_SetAnalogInputMode (HANDLE h_DeviceHandle, BYTE b_InputMode) |
_INT_ | i_PCI3120_GetAnalogInputMode (HANDLE h_DeviceHandle, PBYTE pb_InputMode) |
_INT_ | i_PCI3120_Read1AnalogInput (HANDLE h_DeviceHandle, BYTE b_Channel, BYTE b_Gain, BYTE b_Polarity, WORD w_ConvertingTime, BYTE b_InterruptFlag, PWORD pw_ChannelValue) |
_INT_ | i_PCI3120_ReadMoreAnalogInputs (HANDLE h_DeviceHandle, BYTE b_ChannelCount, PBYTE pb_Channel, PBYTE pb_Gain, PBYTE pb_Polarity, WORD w_ConvertingTime, BYTE b_InterruptFlag, PWORD pw_ChannelValue) |
_INT_ | i_PCI3120_Write1AnalogOutput (HANDLE h_DeviceHandle, BYTE b_Channel, BYTE b_Polarity, WORD w_Value) |
_INT_ | i_PCI3120_WriteMoreAnalogOutputs (HANDLE h_DeviceHandle, BYTE b_ChannelNbr, PBYTE pb_Channels, PBYTE pb_Polarity, PWORD pw_Value) |
_INT_ | i_PCI3120_InitAndStartAnalogInputSequence (HANDLE h_DeviceHandle, DWORD dw_SequenceCount, DWORD dw_SequenceBeforeInterrupt, BYTE b_ChannelCount, PBYTE pb_Channel, PBYTE pb_Gain, PBYTE pb_Polarity, WORD w_ConvertingTime, BYTE b_DelayMode, DWORD dw_DelayTime, BYTE b_ExtTriggerMode) |
_INT_ | i_PCI3120_StopAnalogAcquisition (HANDLE h_DeviceHandle) |
_LONG_ | l_PCI3120_ReadSequenceData (HANDLE deviceHandle, DWORD size, PVOID data) |
_INT_ i_PCI3120_SetAnalogInputMode | ( | HANDLE | h_DeviceHandle, |
BYTE | b_InputMode | ||
) |
Set analog input mode to single-ended or differential input
The input mode has to be set at least once before any call to an analog input function.
Once set, the configuration will last until the program ends, or another mode is set.
In single-ended mode, 16 analog inputs are available.
In differential mode, there are only 8 analog inputs available.
Please refer to the manual for further information.
[in] | h_DeviceHandle | Handle of the board |
[in] | b_InputMode | Input mode (PCI3120_INPUT_MODE_SINGLE_ENDED or PCI3120_INPUT_MODE_DIFFERENTIAL) |
-1 : The device handle parameter is wrong
-2 : Invalid input mode
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_GetAnalogInputMode | ( | HANDLE | h_DeviceHandle, |
PBYTE | pb_InputMode | ||
) |
Get analog input mode (single-ended or differential input)
In single-ended mode, 16 analog inputs are available.
In differential mode, there are only 8 analog inputs available.
Please refer to the manual for further information.
[in] | h_DeviceHandle | Handle of the board |
[out] | pb_InputMode | Input mode (PCI3120_INPUT_MODE_UNDEFINED, PCI3120_INPUT_MODE_SINGLE_ENDED or PCI3120_INPUT_MODE_DIFFERENTIAL) |
-1 : The device handle parameter is wrong
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_Read1AnalogInput | ( | HANDLE | h_DeviceHandle, |
BYTE | b_Channel, | ||
BYTE | b_Gain, | ||
BYTE | b_Polarity, | ||
WORD | w_ConvertingTime, | ||
BYTE | b_InterruptFlag, | ||
PWORD | pw_ChannelValue | ||
) |
Reads the current value of the analog input channel b_Channel with a gain b_Gain, in the input voltage range b_Polarity and a conversion time w_ConvertingTime
[in] | h_DeviceHandle | Handle of the board |
[in] | b_Channel | Channel to read (Single-ended : 0 to 15, differential : 0-7) |
[in] | b_Gain | Input gain. Adjusts the input voltage to be in the converter's range (-10V to 10V) and get the best resolution. Gain acts like a multiplying coefficient, so a value of 2 will double the input voltage before it goes through the converter. For example, if the input voltage is between 0V and 2V, a gain value of 5 should be used. Possible values are PCI3120_GAIN_1, PCI3120_GAIN_2, PCI3120_GAIN_5 and PCI3120_GAIN_10 |
[in] | b_Polarity | Selection of the input voltage range.
|
[in] | w_ConvertingTime | Selection of the conversion time, from 10 to 32767us. |
[in] | b_InterruptFlag | Wether an interrupt is generated at EOS (End Of Sequence) or not |
[out] | pw_ChannelValue | The raw analog value (0x0000 to 0xFFFF) |
-1 : The device handle parameter is wrong
-3 : The input mode has not been set
-4 : A channel index is invalid (single-ended mode)
-5 : A channel index is invalid (differential mode)
-6 : A gain value is wrong
-7 : A polarity value is wrong
-8 : The converting time is invalid
-9 : The interrupt routine is not installed
-10 : Error while calling IOCTL function (wrong handle ?)
-110: The software trigger is invalid (if PCIe3121 DLL wrapper is used)
-111: The external trigger is invalid (if PCIe3121 DLL wrapper is used)
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_ReadMoreAnalogInputs | ( | HANDLE | h_DeviceHandle, |
BYTE | b_ChannelCount, | ||
PBYTE | pb_Channel, | ||
PBYTE | pb_Gain, | ||
PBYTE | pb_Polarity, | ||
WORD | w_ConvertingTime, | ||
BYTE | b_InterruptFlag, | ||
PWORD | pw_ChannelValue | ||
) |
Reads several analog input channels
The priority of the analog input channels is set with the scan list
The scan list allows to determine the input voltage range and the gain for each analog input channel
The gain is defined with parameter pb_Gain for each analog input channel
The input voltage range is defined with parameter pb_Polarity for each analog input channel
[in] | h_DeviceHandle | Handle of the board |
[in] | b_ChannelCount | Number of acquisitions in the sequence (1 to 16) |
[in] | pb_Channel | Array of the channels to read |
[in] | pb_Gain | Array of gain for each channel (see i_PCI3120_Read1AnalogInput) |
[in] | pb_Polarity | Array of input voltage range for each channel (see i_PCI3120_Read1AnalogInput) |
[in] | w_ConvertingTime | Selection of the conversion time, from 10us to 32767us. |
[in] | b_InterruptFlag | Wether an interrupt is generated at EOS (End Of Sequence) or not. Read values are available in the interrupt callback function (if PCIe3121 DLL wrapper is used) |
[out] | pw_ChannelValue | Raw output values (0x0 to 0xFFFF) |
-1 : The device handle parameter is wrong
-2 : The sequence size is wrong
-3 : The input mode has not been set
-4 : A channel index is invalid (single-ended mode)
-5 : A channel index is invalid (differential mode)
-6 : A gain value is wrong
-7 : A polarity value is wrong
-8 : The converting time is invalid
-9 : The interrupt routine is not installed
-10 : Error while calling IOCTL function (wrong handle ?)
-110 : The software trigger is invalid (if PCIe3121 DLL wrapper is used)
-111 : The external trigger is invalid (if PCIe3121 DLL wrapper is used)
-1001 : Error while calling i_PCIe3121_TriggerAnalogAcquisition IOCTL function (wrong handle ?)
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_Write1AnalogOutput | ( | HANDLE | h_DeviceHandle, |
BYTE | b_Channel, | ||
BYTE | b_Polarity, | ||
WORD | w_Value | ||
) |
Write the value of one analog output of the board
In unipolar mode, output voltage range is 0V to 10V
In bipolar mode, output voltage range is -10V to 10V
[in] | h_DeviceHandle | Handle of the board |
[in] | b_Channel | Index of the analog output channel (0 to 7) |
[in] | b_Polarity | Selection of the output voltage range (APCI3120_BIPOLAR or APCI3120_UNIPOLAR) |
[in] | w_Value | Value to write to the output
|
-1 : The device handle parameter is wrong
-3 : Invalid channel
-4 : Invalid polarity
-5 : Invalid value in bipolar mode
-6 : Invalid value in unipolar mode
-7 : Error while calling IOCTL function (wrong handle ?)
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_WriteMoreAnalogOutputs | ( | HANDLE | h_DeviceHandle, |
BYTE | b_ChannelNbr, | ||
PBYTE | pb_Channels, | ||
PBYTE | pb_Polarity, | ||
PWORD | pw_Value | ||
) |
Write values of several analog outputs
In unipolar mode, output voltage range is 0V to 10V
In bipolar mode, output voltage range is -10V to 10V
[in] | h_DeviceHandle | Handle of the board |
[in] | b_ChannelNbr | Number of channels to write (1 to 8) |
[in] | pb_Channels | Array of channels to write (0 to 7) |
[in] | pb_Polarity | Array of polarity of the channel (APCI3120_BIPOLAR or APCI3120_UNIPOLAR) |
[in] | pw_Value | Values to write to the output |
-1 : The device handle parameter is wrong
-2 : b_ChannelNbr is invalid
-3 : Invalid channel
-4 : Invalid plarity
-5 : Invalid value in bipolar mode
-6 : Invalid value in unipolar mode
-7 : Error while calling IOCTL function (wrong handle ?)
-112 : both software and hardware trigger are enabled. (if PCIe3121 DLL wrapper is used). In that case, they must have the same type (one shot, sequence trigger or single sequence) -65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_INT_ i_PCI3120_InitAndStartAnalogInputSequence | ( | HANDLE | h_DeviceHandle, |
DWORD | dw_SequenceCount, | ||
DWORD | dw_SequenceBeforeInterrupt, | ||
BYTE | b_ChannelCount, | ||
PBYTE | pb_Channel, | ||
PBYTE | pb_Gain, | ||
PBYTE | pb_Polarity, | ||
WORD | w_ConvertingTime, | ||
BYTE | b_DelayMode, | ||
DWORD | dw_DelayTime, | ||
BYTE | b_ExtTriggerMode | ||
) |
This function initializes a sequence acquisition
Thanks to a sequence acquisition, you can get analog values from the board very fastely (or slowly if you want)
After having initialized the sequence, to get the data you will have to wait an interrupt, and then read the data from the board.
You may have a look on the sample available with this DLL, that will explain you how to do.
[in] | h_DeviceHandle | Handle of the board |
[in] | dw_SequenceCount | The total number of sequence to acquire. Set it to 0 if you want to use continuous acquisition (i.e. infinite acquisition) |
[in] | dw_SequenceBeforeInterrupt | Specify the number of sequence to wait before generating an interruption. For high frequency, set a high number (512 if using maximum frequency for example). |
[in] | b_ChannelCount | The number of channels in one sequence. Rule: (b_ChannelCount * dw_SequenceBeforeInterrupt) must be a multiple of 2 |
[in] | pb_Channel | Array of the channels to read (see i_PCI3120_Read1AnalogInput) |
[in] | pb_Gain | Array of gain for each channels (see i_PCI3120_Read1AnalogInput) |
[in] | pb_Polarity | Array of polarity for each channels (see i_PCI3120_Read1AnalogInput) |
[in] | w_ConvertingTime | Time interval in us between 2 conversions of successive input channels (from 10 us to 32767 us). |
[in] | b_DelayMode | Specifiy the type of delay to use between two acquisitions of a sequence
|
[in] | dw_DelayTime | Waiting time in us between two conversion cycles (from 100 us to 3276850 us) This parameter is only relevant if APCI3120_DELAY_MODUS or APCI3120_DELAY_1_MODUS are used This parameter must be a multiple of 50 |
[in] | b_ExtTriggerMode | Two modes are possible :
|
_INT_ i_PCI3120_StopAnalogAcquisition | ( | HANDLE | h_DeviceHandle | ) |
Stops any analog acquisition
[in] | h_DeviceHandle | Handle of the board |
-1 : Error while calling IOCTL function (wrong handle ?)
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)
_LONG_ l_PCI3120_ReadSequenceData | ( | HANDLE | deviceHandle, |
DWORD | size, | ||
PVOID | data | ||
) |
Enables to read data acquired by a sequence acquisition.
This function can be called in the interrupt routine that you registered. (see samples)
deviceHandle | handle to the board |
size | size of data to read. To be powerfull, should be ( sequence size * sequence before interrupt ) * sizeof ( USHORT ) |
data | Pointer that will be fill with the data of the board |