AnsweredAssumed Answered

Switching input channels in ADC - ADUCM360

Question asked by Absel on Jan 17, 2018
Latest reply on Mar 7, 2018 by barryzhang



I'm having troubles switching the ADC channel in my program. What I do is call a function CHSELECT(int) in which I specify which channel (int) I want to switch to. 


This function puts the ADC in Idle mode and then I reconfigurate it with the new channel inputs, then, I use AdcGo to start continous conversion (find attached my project code).


The problem is that the lectures of the ADC seems to be affected by the switch. One channel is about 2.2V and the other one is 2.1V, but I'm reading intermediate values. It might be because of the nature of my program, but I think I'm not doing something very special: I just have a while with a flag that is enabled every time I have a PWM interrupt, then, with the ADC value read at the interruption, I decide to change the high time of the PWM. Then, I switch the channel.


I have tried a lot of ways to obtain the same result but I'm getting this bad conversions. Also, apart from this, the PWM cycles don't seem to reconfigurate properly, but I suppose it's all about this problem. I'd be really grateful if you have any ideas.