How fast can readadc10 work?

nbw

Senior Member
I would like to take 600 readings from a custom-built sensor. I could wait a second between readings if the readadc10 command needs time to settle, this would take 10 mins to take all of the readings.

It would be nice to get the 600 as soon as possible.

I'm wondering if there is a length of time that one should wait before taking a subsequent ADC reading or can you "just for it" - i.e. as fast as your code can read the port, that's ok?

If a pause isn't required, I could probably do 5 readings a second, or finish all readings in 2 mins.

thanks
Barney
 

QuIcK

Senior Member
using the vsm, at 20mhz it can do 20 reads in 202ms. and 30 in 309ms. I dont know how accurate timing is in the vsm, but i would think its pretty bang-on
thats without any processing. if you are logging, youd probably want to put them into the scratchpad.

further tests show this is the same on the 08/08m

so i would take that to be 10ms per read and transfer to variable.
to then transfer to scratchpad take about another 4ms for 20, so thats 200us per transfer...
10.3ms per read.

Im not sure if there is a minimum time for the adc to "chill out" tho.
 
Last edited:

nbw

Senior Member
Yeah I wondered if the limiting aspect doesn't apply to ADC, I probably had the 750ms wait for the DS18B20 in the back of my mind. Pretty much as fast as my code can handle it (just about) - that should be ok.

I'd read the ADC, increment a word variable with the value, read the ADC again etc. I should may be able to do up to 50 per second in such a tight loop. Speedy!

Time to rig up and do some testing methinks
 

BeanieBots

Moderator
Unlike readtemp which is limited by the DS18B20 to 750mS, the readadc command only takes around 250uS at 4Mhz. The only 'settling' time required is determined by whatever it is you are measuring. eg any capacitance in your analogue circuit.
 

womai

Senior Member
Just mke sure your source impedance feeding the ADC is 10 KOhms or less (Microchip datasheet value) and you can just "go for it". Running a Picaxe at 16 MHz gives well over 1000 readings per second.

Wolfgang
 

nbw

Senior Member
@ Womai - thanks, I have set up a 3k9, the little 20M seems to be catching and processing around 100 per second which is a good start. A little code streamlining, then moved to a 28X2 (I need a ton of lookup space), and I should as you say notice a slight improvement again :) cheers
 
Top