1.34.1.11 AFECx_ChannelOffsetSet Function

C

void AFECx_ChannelOffsetSet (AFEC_CHANNEL channel, uint16_t offset) // x - Instance of the AFEC peripheral

Summary

Writes the channel offset

Description

This function writes the offset value for the channel. This offset value is added to the value of sample to get the full range output (0 to Vref). Normally, this value should be set to Vref/2 in 10-bit format.

Precondition

AFECx_Initialize() must have been called first for the associated instance.

Parameters

Param Description
channel channel number
offset 10-bit offset generated by internal DAC

Returns

None.

Example

AFEC0_Initialize();
AFEC0_ChannelOffsetSet(AFEC_CH0, 512U);

Remarks

Offset should be set at the initialization. If this function is called when conversion is on-going, offset will be applied from the next conversion. Offset is added to the sample value and thus offset limits the input voltage range. Offset less than Vref/2 will result in ADC saturation for input voltage greater than Vref/2.