I am thinking of a project for Galileo which will require me to be able to read an ADC Channel voltage about 1,000 times per second.
Now, I wasn't sure if that was possible, or if I'd need to do some fancy coding to put the ADC into continuous mode and then somehow buffer the results at EOC or whatever. (And I might still do that).
However I just wanted to see how quickly I could read from A0.
At the same time I was experimenting with timed-tasks in C, using 'alarm' so I combined both interests and came up with this:
A simple C program that reads from the ADC as quickly as it can, while at the same time interrupting itself every 1mS.
After 1000 interruptions (about 1 second) it prints out how many times it has been able for read from the ADC.
It seems that with this rather un-optimal approach I can read at over 2300 times a second.
With some tidying up of the code and a better approach I think it could be even faster.
Then, by playing with the buffering I could probably achieve something an order of magnitude higher.
Here's the C code.
Retrieving data ...