I am facing a very weird problem. I enable timer capture in an ISR to measure the length of an event (in this case a rising edge). this event is periodic and doesn't change. However when i read the values from the timer register they vary all the time. I clear the respective flags and completely stop the timer only to start it at the next event. it is absolutely crucial that this value remains the same. I even measured it using an oscilloscope and it seems fine on the oscilloscope. Why is the timer value varying? How do i correct this problem?