1.39.1.7 ADCx_ConversionResultGet Function

C

uint16_t ADCx_ConversionResultGet( void ); // x is instance of the peripheral and it is applicable only for devices having multiple instances of the peripheral.

Summary

Returns the conversion result of the channel.

Description

This function returns the result of completed conversion of the channel.

Precondition

ADCx_Initialize() function must have been called first for the associated instance.And conversion must have been started. Also check whether result is ready to read.

Parameters

None.

Returns

adcResult - conversion result of the channel.

Example

uint16_t adcResult = 0;
ADC0_Initialize();
ADC0_ConversionStart();
while(!ADC0_ConversionStatusGet());
adcResult = ADC0_ConversionResultGet();

Remarks

This function can be called from interrupt or by polling the status when result is available. User should decode the result based on result sign mode (differential mode) and result resolution (8, 10, 12 or 16 bit) configuration.