AnsweredAssumed Answered

How to switch to another ADC channel on the fly?

Question asked by dinrail on Feb 6, 2014
Latest reply on Feb 10, 2014 by MMA

I have been using ADuCM361's AIN0 / AIN3 pair for ADC channel successfully, with AIN0 for positive input, AIN3 for negative input.

 

with the following pin configuration:

 

AdcPin(pADI_ADC1,ADCCON_ADCCN_AIN3, ADCCON_ADCCP_AIN0); // Select AIN0 as postive input and AIN3 as negative input

 

Now I need to switch to AIN2/AIN3 pair on the fly, with AIN2 for positive input, AIN3 for negative input, so I call

 

AdcPin(pADI_ADC1,ADCCON_ADCCN_AIN3,ADCCON_ADCCP_AIN2); // Select AIN2 as postive input and AIN3 as negative input

 

but the ADC reading is totally wrong. I can't even tell which pins the ADC channels configured for

 

Is there anything else I need to do besides changing the above codes on the fly?

Outcomes