ADC reading polling method

Thread Starter


Joined May 26, 2012
I have this confusion it is generic question. I am trying to read the ADC value in polling method. It will take some time for the conversion to be complete. So do i need to wait in the loop continuously till the conversion is complete or i can start executing the next instructions. If i keep waiting in the loop will i not be wasting processor time? What is the industry method followed? Any pseudo code available? Please advise.


Joined Jun 4, 2014
It depends on the requirements of your application.

You could sit in a loop waiting for the end of conversion, proceeding with the rest of the program when the result is available. Note that interrupts would still happen while in this loop so the processor can still be doing stuff.

Many programs run around a loop doing the tasks within that loop in sequence repeatedly and one of those tasks could be checking whether the ADC result is available.

Processor time is only wasted if there is something else which could be done. Consider a program which does everything by using interrupts. While there are no interrupts the processor will be sitting in a loop (or possibly sleeping to save power) waiting for the next interrupt. Is the time spent in that loop or sleeping wasted?