I successfully managed to implement a square wave signal generator with direct access to timer one.
Now I wish to do the opposite, get familiar with the concept of time measurement using the timer.
I guess that instead of loading the timer with a value I now let it free-run and set an interrupt. At this point the value of the timer is stored and some calculations are made with base on the system clock, the count number and any prescaller division.
Now the questions:
Is the above correct? Perhaps anything missing that might be important?
is there any example code I could use to get an idea?
How are filters implemented, for example, to make sure a frequency above the maximum limit is filtered, or a pulse with a very short duration is ignored?
PS: Yes, I am aware that there are lots of libraries to achieve time measuring functions.
The intent of the post is to get familiar with the concepts at a low level.