DioPmuGetComparisonResult

Applies To

GX5295

Purpose

Returns the PMU input comparators states and comparison validity bit.

Syntax

DioPmuGetComparisonResult (nHandle, nChannel, pdwComparisonResults, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
DIO Master or Slave board handle.
nChannel
SHORT
If Board Handle was passed:
Channel number in the DIO board, each board has 32 I/O channels. I/O channels number range is 0-31.
Each DIO board has 4 Auxiliary channels. Auxiliary channels number range is 0-3.
If Master Board Handle was passed:
Channel number in the DIO domain, each DIO board adds 32 I/O channels. I/O channels number range is 0-991 (1 master and 30 slaves).
Each DIO board adds 4 Auxiliary channels, Auxiliary channels number range is 0-123 (1 master and 30 slaves)
pdwComparisonResults
PDWORD
Returned comparison result, the returned comparison result has the following structure:
Bit 0: Low level comparison result:
  • Bit low: The actual input level was below the comparator low level as was set by DioPmuSetupComparatorsValues API.
  • Bit high: The actual input level was equal or above the comparator low level as was set by DioPmuSetupComparatorsValues API.
Bit 1: High level comparison result:
  • Bit low: The actual input level was below the comparator high level as was set by DioPmuSetupComparatorsValues API.
  • Bit high: The actual input level was equal or above the comparator high level as was set by DioPmuSetupComparatorsValues API.
Bit 2: Comparison validity,  returns the validity of the low and high comparators result (see comments for details):
  • Bit low: Invalid comparison.
  • Bit high: valid comparison.
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 2-bit “go / no-go” test with a low and high threshold settings. The comparators can be used for a high speed go / no-go” test of the I/O voltage at any time or when the channel is set to be in Forced Voltage mode the user  can either do a high speed go / no-go” test of the I/O voltage or current.

I/O Voltage comparison

The PMU comparator window compares the I/O voltage against an upper and lower voltage limits. The voltage thresholds are set using the DioPmuSetupComparatorsValues function call.

Note: The comparators source need to be set to set to voltage comparison by calling DioPmuSetupComparatorsSource API.

Forced Current comparison

The PMU comparator window compares the output forced current level against an upper and lower current limits. The current thresholds are set using the DioPmuSetupComparatorsValues function call, and the values are in mA.

In order to get higher comparison accuracy the user may set the comparators’ current range by calling DioPmuSetupForcedCurrent with the desired current range API.

Note: The comparators source need to be set to current comparison by calling DioPmuSetupComparatorsSource API.

Validity bit description

The following table lists the comparators’ Validity bit description:

Condition
Comparison Result
Level > High Comparator’s Threshold
 
1
Level < Low Comparator’s Threshold
Level < High Comparator’s Threshold and Level > Low Comparator’s Threshold
Undefined

 

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

 

Note: Current comparison is available on any Gx5295 board that was calibrated after June 11, 2012 and using GTDIO v4.1 (Build 60) or above.

 

Example

I/O Voltage comparison example:

This example demonstrates the comparison of channel 1 I/O voltage levels:

SHORT nStatus;

DWORD dwComparisonResult;

 

// Setup comparators source to voltage comparison

 

DioPmuSetupComparatorsSource(nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 1, NULL, 1, DIO_PMU_COMPARATORS_SOURCE_IO_VOLTAGE, &nStatus);

// Set channel 1 high and low comparator voltage level

DioPmuSetupComparatorsValues(nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 1, NULL, 1, 2.5, -1, &nStatus);

// Returns the Comparison result

DioPmuGetComparisonResult(nHandle, 1 &dwComparisonResult, &nStatus);

Forced Voltage current comparison example:

This example demonstrates the comparison of channel 1 current low and high levels in forced voltage mode:

SHORT nStatus;

DWORD dwComparisonResult;

 

DioSetupChannelMode(nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 1, NULL, 1, DIO_CHANNEL_MODE_PMU_FORCE_VOLTAGE, &nStatus) ;

// Set channel 1 forced voltage level

DioPmuSetupForcedVoltage (nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 1, NULL, 1, 1.5, GX529X_PMU_CURRENT_RANGE_N32MA_TO_P32MA, DIO_PMU_FV_SETUP_DEFAULT, 0, &nStatus);

// Set channel 1 high and low comparator current level (in mA)

DioPmuSetupComparatorsValues(nHandle, DIO_CH_LIST_MODE_RANGE_OF_CHANNELS, 1, NULL, 1, 2.5, -1, &nStatus);

// Returns the Comparison result

DioPmuGetComparisonResult(nHandle, 1, &dwComparisonResult, &nStatus);

 

See Also

DioPmuSetupComparatorsValues, DioPmuSetupComparatorsSource, DioPmuSetupForcedCurrent, DioPmuSetupForcedVoltage,  DioPmuSetupForcedCurrentCommutatingVoltage, DioGetErrorString