|
发表于 2012-5-26 22:29:20
|
显示全部楼层
it depends on how slow your 低频 signal is and what your requirements are.
You can still use the same approach I outlined earlier for slow speed signals. However, if your signal is very slow (in terms of Hz), or you require higher precision in those cases, you may use capture, or external int - to time the duration between two interrupts.
It goes something like this:
1) set the timer to count cpu frequency. don't start yet.
2) when the 1st pulse arrives, turn on the timer and start counting.
3) when the 2nd pulse arrives, turn off the timer and the count in the timer + cpu frequency tells you how much time has elapsed -> you know the external pulse's period / frequency.
|
|