multiple frequency measurement with ATMEGA16

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I am working on a project where i need to measure frequencies from a external source.

Frequency range will be upto 2Khz
number of channels will be 4

I am using Atmega16.

I am confused on how to work around with just one timer and two external counters in ATMEGA16.

_____________________ Love and Peace keeps PrOgraMmerS happy :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go on. Your mega16 can run at up to 16MHz. That is 8000 cpu clock cycles for one 2kHz period. Even at 1MHz, you have 500 clock cycles.

So you could simply read all your inputs in software. If a pin has changed, you read the time. Associate that pin with the end of a half-cycle.

If you needed 'high' frequency, you would use the two external hardware counters. Since your requirements are modest, software would be fine. You could also use INT0, INT1 pins for detecting the pin-changes.

If you count the relevant pin-changes in a one-second interval, you have a direct 'Hz' result. Any latency is insignificant. After all, you should catch each transition quite easily.

There are many ways to skin cats.

David.