1.10.1.14 ADCHS_ChannelResultGet Function

C

uint16_t ADCHS_ChannelResultGet (ADCHS_CHANNEL_NUM channel)

Summary

Reads the conversion result of the channel

Description

This function reads the conversion result of the channel

Precondition

ADCHS_Initialize() must have been called first for the associated instance. And conversion must have been started.

Parameters

Param Description
channel channel number

Returns

uint16_t - conversion result

Example

uint16_t result;
bool status;
ADCHS_Initialize();
ADCHS_ChannelsEnable(ADCHS_CH0);
ADCHS_ConversionStart();
status = ADCHS_ChannelResultIsReady(ADCHS_CH0);
if (status)
{
    result = ADCHS_ChannelResultGet(ADCHS_CH0);
}

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 (signed or unsigned result) and result resolution (12, 13, 14, 15 or 16 bit result) configuration.