DioPmuSetupComparatorsValues

Applies To

GX5295

Purpose

Sets the channels' comparators’ high and low settings.

Syntax

DioPmuSetupComparatorsValues (nHandle, nChannelListMode, nCountOrFirstChannel, panChannelList, nLastChannel, dHighVal, dLowVal, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
DIO Master or Slave board handle.
nChannelListMode
SHORT
Channel list mode dictates how nCountOrFirstChannel and panChannelList parameters are used. Channel list mode options are as follows:
0  DIO_CH_LIST_MODE_ARRAY_OF_CHANNELS: The user specifies an array of channels where nCountOrFirstChannel is the number of elements in the list array and panChannelList is an array contains the channels numbers. In this mode nLastChannel is ignored.
1  DIO_CH_LIST_MODE_ALL_BOARD_CHANNELS: Apply the settings to all the board’s channels associated with this board handle. In this mode nCountOrFirstChannel, panChannelList and nLastChannel variavles are ignored.
2  DIO_CH_LIST_MODE_ALL_DOMAIN_CHANNELS: Apply the settings to all the channels in the domain, e.g. if there are two boards in the domain (Master and a Slave), then all 64 channels will be set. In this mode nCountOrFirstChannel, panChannelList and nLastChannel variavles are ignored.
3  DIO_CH_LIST_MODE_RANGE_OF_CHANNELS: Apply settings to a range of channels where nCountOrFirstChannel is the first channel number and nLastChannel is the last channel number. In this mode panChannelList variavle is ignored.
nCountOrFirstChannel
SHORT
If nChannelListMode parameter is set to DIO_CH_LIST_MODE_ARRAY_OF_CHANNELS, then it is specifying the number of elements in the panChannelList array parameter.
If nChannelListMode parameter is set to DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, then it is specifying the first channel number to apply the settings to,
otherwise it is ignored and should set to zero.
Each DIO board adds 32 I/O channels and 4 Auxiliary channels. I/O channels number range is 0-991 (1 master and 30 slaves). Auxiliary channels number range is 0-123 (1 master and 30 slaves)
panChannelList
PSHORT
Array of channels numbers. Channels numbers can be from 0 to the last channel in the domain. E.g., if the domain has two boards then the last channel is 63.
This parameter is only used if nChannelListMode parameter is set to DIO_CH_LIST_MODE_ARRAY_OF_CHANNELS, otherwise is should be passed as NULL.
Gx5295: Auxiliary channels numbers are 1000 to 1003.
nLastChannel
SHORT
If nChannelListMode parameter is set to DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, then it is specifying the last channel number to apply the settings to.
Otherwise it is ignored and should set to zero.
Each DIO board adds 32 I/O channels and 4 Auxiliary channels. I/O channels number range is 0-991 (1 master and 30 slaves). Auxiliary channels number range is 0-123 (1 master and 30 slaves)
dHighVal
DOUBLE
 Comparators high voltage level settings.
  • If the comparators’ source was set to DIO_PMU_COMPARATORS_SOURCE_IO_VOLTAGE: I/O (0) the value is in voltages and can be between -2.V to and +7.0V and should to be less than dHighVal.
  • If the comparators' source was set to DIO_PMU_COMPARATORS_SOURCE_FORCED_CURRENT: I/O (1) the value is in mA and should to be less than dHighVal. The value should be inside the current range limits as was set by the PMU Forced Current range settings, see the DioPmuSetupForcedCurrent API for value limits.
dLowVal
DOUBLE
Comparators low voltage level settings.
  • If the comparators’ source was set to DIO_PMU_COMPARATORS_SOURCE_IO_VOLTAGE: I/O (0) the value is in voltages and can be between -2.V to and +7.0V and should to be less than dHighVal.
  • If the comparators ‘source was set to DIO_PMU_COMPARATORS_SOURCE_FORCED_CURRENT: I/O (1) the value is in mA and should to be less than dHighVal. The value should be inside the current range limits as was set by the PMU Forced Current range settings, see the DioPmuSetupForcedCurrent API for value limits.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Each channel’s PMU (parametric measurement unit) supports two high-speed window comparators. The PMU on-chip window comparator supports a 2-bit “go / no-go” test with a low and high threshold settings. The thresholds are set using the DioPmuSetupComparatorsValues function call.

The PMU comparator window translates the forced voltage or the forced current being sensed into an output voltage that can be compared against an upper and lower limit.

The PMU window comparator low and high outputs can be read back directly providing direct access to the actual comparator status at any time.

Example

The following example uses an array of channels list to set their comparators’ high level to 3.0V and low levels to -1.0V:

SHORT anChannelList[]={0, 2, 5, 7, 9, 13, 14, 27};

DioPmuGetComparatorsValues (nHandle, DIO_CH_LIST_MODE_ARRAY_OF_CHANNELS, 8, anChannelList, 0, 4, -1, &nStatus);

The following example sets all the board’s channels comparators’ high level to 3.0V and low levels to -1.0V:

DioPmuGetComparatorsValues (nHandle, DIO_CH_LIST_MODE_ALL_BOARD_CHANNELS, 0, NULL , 0, 4, -1, &nStatus);

The following example sets all the boards channels comparators’ high level to 3.0V and low levels to -1.0V:

DioPmuGetComparatorsValues (nHandle, DIO_CH_LIST_MODE_ALL_DOMAIN_CHANNELS, 0, NULL , 0, 4, -1, &nStatus);

The following example sets channels 5 to 10 comparators’ high level to 3.0V and low levels to -1.0V:

DioPmuGetComparatorsValues (nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 5, NULL, 10, 4, -1, &nStatus);

 

See Also

DioPmuGetComparisonResult, DioPmuSetupComparatorsValues, DioPmuGetComparatorsSource, DioPmuSetupForcedCurrent,  DioPmuSetupForcedVoltage, DioGetErrorString