Question: I would like to multiplex multiple analog inputs to an incremental ADC (ADCINC12, ADCINCVR, ADCINC, ADCINC14). What are the factors that I need to remember while doing this?
Response: The incremental ADC is a combination of an SC block modulator, a timer or PWM to set the integration time and a counter to integrate the bit stream from the modulator. At the end of each integration cycle, the timer or PWM generates an interrupt and the CPU reads the counter which is the ADC result. The reading of the counter takes place inside the ISR. The ideal timing to change the input to the ADC would be at the end of conversion.
If the ADC is running in continuous sampling mode, and if the input to the ADC is changed in the foreground, there is no guarantee that the input is changed exactly at the end of conversion. Because of this, the subsequent sample from the ADC will have some cross talk from the previous signal. To avoid this drop one ADC sample after changing the input. Dropping sample will reduce the throughput of the ADC.
The second alternate is to switch the signal inside the ADC’s ISR. All the ADCs have an ISR file like ADCINCVR_1INT.asm, ADCINC_1INT.asm etc. Inside the ISR, there will be a custom code marker area where you can add code to switch between the inputs.
The third alternate is to run the ADC in single sample mode. Change the input to the ADC and use the ADC_GetSamples(1) function call. This way the ADC will be stopped after one conversion and the next conversion may be initiated after switching the input signal.