Pretty much based on the knowledge that the MCU program counter is clocked on a 16MHz crystal (according to http://en.wikipedia.org/wiki/Quartz_clock they are generally good for 6 parts per million for standard grade crystals, whatever that is).
You can use this in a number of ways. If you program it using a standard loop to read inputs, calculate and write out to say a LCD display, you should have a loop-length of known number of CPU cycles. (This is quite possible with a microcontroller as everything is in memory and as long you aren't waiting for random DMA interrupts should be quite feasible. A general purpose CPU running a mega operating system with lots of peripherals would make this task pretty much impossible). Another option is to use the built-in timer/counters (one 8 bit and one 16 bit are available) on the AVR ATmega MCU. Again clocked against the same crystal, and using a configurable frequency divider mechanism. And finally there are various dedicated real-time chips, such as DS1307, which combined with a crystal (usually 32.768KHz) can be easily interfaced if needed. These chips tend to be human-scale timers so you might have to count lots of repetitions of your loop under test and do the maths to get an average loop time (possibly limiting its usefulness). Regards, Martin martinvisse...@gmail.com On Wed, May 26, 2010 at 3:55 PM, Nick Andrew <n...@nick-andrew.net> wrote: > On Wed, May 26, 2010 at 01:53:27PM +1000, Martin Visser wrote: > > (And if you don't have a scope or freq. meter) a suitably programmed > Arduino > > or similar microcontroller could do this fairly easily for you - probably > > with better than 0.01% precision. > > How do we know the Arduino is so precise? :-) > > Nick. > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html