Software Library API naibrd 2.24.0
See all documentation at naii.docs.com

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_AD_SetThresholdDetect (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ad_threshold_detect_id_type_t thresholdID, float64_t thresholdSet, float64_t thresholdClear)
 Sets the A/D thresholds that set and clear the status for the specified thresholdID (Threshold1 or Threshold2) and channel. The threshold direction and hysteresis, which are required by the H/W, are derived from 'set' and 'clear' values.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_AD_GetThresholdDetect (int32_t cardIndex, int32_t module, int32_t channel, naibrd_ad_threshold_detect_id_type_t thresholdID, float64_t *p_outthresholdSet, float64_t *p_outthresholdClear)
 Retrieves the A/D thresholds that set and clear the status for the specified thresholdID (Threshold1 or Threshold2) and channel. The threshold 'set', 'direction' and 'hysteresis' are read from the H/W and are used to derive the threshold 'clear' value.
 

Detailed Description

Function Documentation

◆ naibrd_AD_GetThresholdDetect()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AD_GetThresholdDetect ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_ad_threshold_detect_id_type_t thresholdID,
float64_t * p_outthresholdSet,
float64_t * p_outthresholdClear )

Retrieves the A/D thresholds that set and clear the status for the specified thresholdID (Threshold1 or Threshold2) and channel. The threshold 'set', 'direction' and 'hysteresis' are read from the H/W and are used to derive the threshold 'clear' value.

Hysteresis and Direction Explained: Hysteresis is the value that the input must change in order for the Threshold status to clear. Threshold direction is the direction that the threshold applies to. If the threshold direction is NAI_AD_RISE_THRESHOLD, then the A/D value must rise above thresholdset to set the threshold status. The status will clear when the A/D value falls below thresholdset by the hysteresis amount.

Note: Thresholds and hysteresis voltages are converted to a digital value based on the range setting. Be sure to set the range before setting the thresholdset and thresholdclear. Failing to do so will result in unexpected behavior.

Example: thresholdset1 = 5, thresholdclear1 = 3 (derived hysteresis1 = 2, derived direction1 = NAI_AD_RISE_THRESHOLD)

5V..   ..   .. .-------------
4V             /^            \
3V..   ..   ../ : ..  .  ..  .\
2V           /  :             ^\
1V          /   :             : \
0V  _______/    :             :  \________
                :             :
           Threshold1     Threshold1
           Status Sets    Status Clears
              at 5V         at 3V
Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
thresholdID: (Input) NAI_AD_THRESHOLD_DETECT_ID1 or NAI_AD_THRESHOLD_DETECT_ID2.
p_outthresholdSet: (Input) Threshold (v/mA) that sets the threshold status.
p_outthresholdClear: (Input) Threshold (v/mA) that clears the threshold status.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_AD_SetThresholdDetect()

NAIBRDFUNC nai_status_t NAIAPI naibrd_AD_SetThresholdDetect ( int32_t cardIndex,
int32_t module,
int32_t channel,
naibrd_ad_threshold_detect_id_type_t thresholdID,
float64_t thresholdSet,
float64_t thresholdClear )

Sets the A/D thresholds that set and clear the status for the specified thresholdID (Threshold1 or Threshold2) and channel. The threshold direction and hysteresis, which are required by the H/W, are derived from 'set' and 'clear' values.

Hysteresis and Direction Explained: Hysteresis is the value that the input must change in order for the Threshold status to clear. Threshold direction is the direction that the threshold applies to. If the threshold direction is NAI_AD_RISE_THRESHOLD, then the A/D value must rise above thresholdset to set the threshold status. The status will clear when the A/D value falls below thresholdset by the hysteresis amount.

Note1: Thresholds and hysteresis voltages are converted to a digital value based on the range setting. Be sure to set the range before setting the thresholdset and thresholdclear. Failing to do so will result in unexpected behavior.

Note2: Since this API derives the direction from the difference of thresholdset and thresholdclear, they should not be equal. Please ensure that there is a difference between thresholdset and thresholdclear. If thresholdset and thresholdclear are equal, a direction of 'rising' will be used. Also note that setting them too close together will cause rapid setting-and-clearing within the noise of the signal.

Example: thresholdset1 = 5, thresholdclear1 = 3 (derived hysteresis1 = 2, derived direction1 = NAI_AD_RISE_THRESHOLD)

5V..   ..   .. .-------------
4V             /^            \
3V..   ..   ../ : ..  .  ..  .\
2V           /  :             ^\
1V          /   :             : \
0V  _______/    :             :  \________
                :             :
           Threshold1     Threshold1
           Status Sets    Status Clears
              at 5V         at 3V
Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
thresholdID: (Input) NAI_AD_THRESHOLD_DETECT_ID1 or NAI_AD_THRESHOLD_DETECT_ID2.
thresholdSet: (Input) Threshold (v/mA) that sets the threshold status.
thresholdClear: (Input) Threshold (v/mA) that clears the threshold status.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.