Question: The ADC is getting stuck in the conversion process. The program gets stuck waiting for the ADC_fIsDataAvailable function to return a non-zero value. What could be the reason?
There can be many possible reasons for an ADC getting stuck in the conversin.
1. Global Interrupts Not Enabled: The ADC, for it's correct operation needs the Global interrupts to be enabled. Make sure to call the M8C_EnableGInt macro in the beginning of the code.
2. Data Clock Above Specification: Check if the column clock to the ADC is within spec. Check out the ADC's user module data sheet for the limit on the Column Clock for various powers of operations.
3. Conversion Not Enabled: For the ADCINC12 to start conversion, the function ADCINC12_GetSamples has to be called. If this function is not called, the ADC conversion will not happen and the program will get stuck waiting for the ADCINC12_fIsDataAvailabel function to return a non-zero value. Make sure to call the ADCINC12_GetSamples function to start the conversion.
The above points apply to all incremental and Delta Sigma ADCs. Check out the Blog post "ADC - The Five Golden Rules" that provides more information about various points that need to be taken care of for the correct functioning of an ADC.