Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

When does the ADC start reading again in interupt mode?

Simple question, I have set my ADC to read in "continuous"/interrupt mode and I take the reading the following way:

ISR(ADC_vect) {
 int val = ADCL;
 val += ADCH << 8;
 ... //Code to do stuff with reading here.
 }

My question is does the ADC start the new reading as soon as I have read the ADCH register or does it wait for the code inside the interrupt to finish? Basically I need to know if having more instructions in the interrupt will slow down my reading rate.

I don't have an oscilloscope or any good way to measure my reading rate accurately enough to know if a few extra lines of codes is affecting the rate or not.

Answer*

Draft saved
Draft discarded
Cancel
3
  • Thanks for the clarification :) Quick unrelated question (if you don’t know the answer I’ll delete this comment). In some debugging efforts I hooked up the A0 pin I was reading from to ground with a 300k resistor between them and got some rather significant ( up to 20 ) readings from it, fluctuating like a wave. I would expect it to be 0, what exactly is being measured when doing this? I thought the ADC did not recieve any voltage inside itself so where is the voltage comming from? :s guessing this is related to "floating pin readings", but I am still confused. Commented Jun 6, 2020 at 20:35
  • @BeaconofWierd that's probably your circuit catchinh some electromagbetic radiation and 300kOhm is simply too high to pull the analog pin to ground in that case. If you imagine you increase this resistance, at some point you would consider the pin floating (maybe at 1MOhm or at 100MOhm?). Commented Jun 6, 2020 at 22:06
  • @BeaconofWierd: I agree with Sim Son that the resistance is too high. According to the datasheet, the ADC should be fed the voltage to be measured from a source with no more than 10 kΩ of internal impedance. Commented Jun 6, 2020 at 22:17

AltStyle によって変換されたページ (->オリジナル) /