> I have a connex, wifistix, and a robostix, and I want to poll recursively a
> ADC channel on the robostix (which is connected to an external sensor) at a
> fixed frequency (say 600Hz).
> Could someone explain how I could achieve this? How do I ensure the ADC
> channel is sampled at exactly the specified frequency from the gumstix?
I'd setup a timer which generates an interrupt at the desired
frequency. I'd make the ISR handler initiate the ADC sample.
Since the gumstix clock runs at 16 MHz, you need to generate an ISR
once every 26667 ticks, which is almost 600 Hz (599.993 Hz), or once
every 26666 ticks, which is 600.015 Hz.
If you use one of the 16 bit timers, with a prescalar of 1, then you
can use WGM mode 4 (see page 133 of the ATMega128 datasheet) and set
one of the OCR registers to 26666 or 26667 to get the interrupt
generated at the desired rate.
Shuswap, BC, Canada