Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Timer as counter...

2006-05-24 by brendanmurphy37

--- In lpc2000@yahoogroups.com, Mukund Deshmukh <betacomp_ngp@...> 
wrote:
> I too have a similar problem, but I want measure 4 channel low 
freq (about 1
> Khz) signal.
> Any idea how it could be implemented using one timer.
> Earlier we were using C8051F040, which has five timers.
> 

You don't say anything about the signals, e.g. whether they're 
analog or digital, or how stable they are in frequency.

If the frequency isn't changing much over a reasonable time frame, a 
very simple way to measure the frequency would be to have a single 
timer interrupt at a rate somewhat faster than the expected 
frequency (in this case, maybe 10 kHz or so). In the interrupt 
handler you can sample all channels and work out if each signal has 
changed phase since the last sample for that channel. After so many 
interrupts (the count depends on how often you need a reading), a 
simple sum will give you the frequency of each channel from the 
number of phase changes detected.

Obviously if the frequency is changing rapidly, this technique won't 
give very acurate results, as it's essentially averaging the 
measurement over a period.

There are many ways of measuring or detecting signal's frequency: if 
you give more details of exactly what you're trying to do, other 
techniques might be more appropriate.

Brendan.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.