How accurate do you need it and how long will the timer run at a time?
If you need to do other things while the timer is running then an interrupt will be needed. Search the forum for timers.
If you want something quick and dirty and nothing else will be happening when the time is collected this idea might work for you.
When the button is pushed goto a time loop and stay there until the button is pushed again.
While in that loop have a pause for a certain amount of time . Count to a variable each time (T=T+1) through the loop. When you are out of the loop read the variable.
Say the pause is 100 ms and it goes through the loop 10 times. that would equal 1 second plus execution time.
Bookmarks