Best way to get frequency of a signal on the Atmel AT91R4008?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


I need to know the frequency of a signal that varies from about 1 Hz to
20 Hz. I was thinking of setting up an external interrupt that interrupts
when the RPM magnet goes by and to read one of the 3 timers in the
processor to compute the period of the signal.

Does that sound like the correct way to do this? It seems that I could do
something with interrupting the timer directly instead, for example, with
tioa2 but I'm not sure how that would work.

I'd probably get timer overflows at the lower rpm's.

Does anyone have a short example of how to do this?

Jim



Re: Best way to get frequency of a signal on the Atmel AT91R4008?

Quoted text here. Click to load it
to
interrupts

Different frequency ranges, but I did this to give tach feedback on an
ATtiny26 in a project in my recent book. Email me and I will send you
the schematic and sourcecode. It also has some SPI and software PWM
stuff in there that you might (might) find useful.


Re: Best way to get frequency of a signal on the Atmel AT91R4008?
Quoted text here. Click to load it

You're on the correct path for such low frequencies. The proper
way is to time the cycles - tunrning it to a period measurement
(time instead of frequency).

Let a timer free run in the capture mode and catch the sensor events
with the timer capture. You can extend the counter with software
count triggered with timing overflow, if the amount of full timer
cycles cannot be detected with some other method.

HTH

--

Tauno Voipio
tauno voipio (at) iki fi



Site Timeline