Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 10 months ago.
sample time use in analogin?
HI everyone, right now i am doing a PID wit the FRDM-KL25Z but i need the sample time used in the AnalogIn Function. if anybody can help me.. please.
1 Answer
10 years, 10 months ago.
AnalogIn requires something like 40us on the KL25Z. The sample time depends on how often you call it. You can for example use a Timer to measure it.
https://mbed.org/users/Sissors/code/FastAnalogIn/ can also be used, it continious mode it requires something like 2us for a read, in non-continious mode roughly 10us.
ok, lets say this is my code AnalogIn ain1(PTB0); AnalogIn ain2(PTB1); AnalogIn ain3(PTB2); char valor; int main(void) { while(true) {
pc.printf(" %f ",(ain3.read()*5+ain2.read()*5+ain1.read()*5)/3); wait(.1); } }
how long will it takes for the adc to read each sample. what about the convertion time.. as far as i know in Codewarrior you set that when you are setting the adc configuration. please help me
posted by 13 Mar 2014