3.3.4.11 EMAFE_EnableVariationDetection Function

C

void EMAFE_EnableVariationDetection(EMAFE_COMP_CHANNEL_ID channel, uint16_t limit);

Summary

Enables the detection of variation of the filtered data.

Description

A detection of variation of the filtered data of an enabled channel can be performed and trigger an interrupt or raise a flag when the variation exceeds a threshold. The threshold and the channel to analyze are configurable.

The variation detection is useful for channels carrying a low variation value over time (e.g., temperature, and so on) to prevent the channel to be included in the DMA transfer and processed downstream by the software to detect a significant variation. This hardware detection circuitry reduces the amount of system memory by reducing the size of DMA transfer and reduces the CPU intervention and software.

The threshold is useful to report variation event only for significant variation for the target application, or simply getting rid of the potential noise still carried on truncated data.

Precondition

None.

Parameters

ParamDescription
channelVariation Detection Channel Selection
limitVariation Detection Limit for Event Triggering

Returns

None.

Example


EMAFE_EnableVariationDetection(EMAFE_COMP_CHN_2_ID, limitValue);

Remarks

Each new converted data is compared (16 MSB only) with a first threshold, defined as the reference data plus VAR_LIMIT and a second threshold defined as the reference data minus VAR_LIMIT. If the selected channel data exceeds the upper (first threshold) or lower bounds (second threshold), the flag EMAFE_ISR.CHGCH raises and an interrupt can be triggered if the EMAFE_ISR.CHGCH =1. The 16 MSB of the new converted value are stored to act as the new reference data for next comparisons.

Figure 3-23. Channel Variation Detection