hobby_85
Junior Member level 2
Hey, Im new to microcontrollers so i apologize if the question is trivial.
Im using a 16f690 PIC and its timer to measure the time interval between two pins going high. The pins go high microseconds after each other.
So im using a 4mhz clock, with a prescalar of 16, meaning each count is 16us. So the timer overflows every 16us*255= 4.08 ms. (I think) Im still new to microcontrollers. Am i right so far?
Now, what im doing is when the first signal comes in, i set the timer register to 0, and when the second signal comes in, i use an interupt to read the timer register. So i get counts like 2,50,135 and so on. However, i dont know if the timer has overflowed. a timer register of 50 could mean 256 +50 instead. Is there a way of know how many exact counts have passed?
thanks
Im using a 16f690 PIC and its timer to measure the time interval between two pins going high. The pins go high microseconds after each other.
So im using a 4mhz clock, with a prescalar of 16, meaning each count is 16us. So the timer overflows every 16us*255= 4.08 ms. (I think) Im still new to microcontrollers. Am i right so far?
Now, what im doing is when the first signal comes in, i set the timer register to 0, and when the second signal comes in, i use an interupt to read the timer register. So i get counts like 2,50,135 and so on. However, i dont know if the timer has overflowed. a timer register of 50 could mean 256 +50 instead. Is there a way of know how many exact counts have passed?
thanks