crocklip
Junior Member level 1

16f877a mplab timer time
hi,
I am using a PIC 16f877a-
I am trying to find the period of a signal being input to an input pin. To do it I start the timer (TMR0) when the the input pin goes high for the first time. after 20 periods of the input signal I stop the timer. by doing this I can divide the value of the timer at this point by 20 and then multiply the result by the period of the timer. This should give me the period of the input signal... So my question is can the PIC handle the following code:
timer_time = (((0xFF)*(overflow_acc) + TMR0)*(1/0.000064));
signal_period = (timer_time/20);
where 0.000064 is the period of the timer(TMR0)
I'm using the HI-TECH C compiler.
Any help would be great,
Thanks
hi,
I am using a PIC 16f877a-
I am trying to find the period of a signal being input to an input pin. To do it I start the timer (TMR0) when the the input pin goes high for the first time. after 20 periods of the input signal I stop the timer. by doing this I can divide the value of the timer at this point by 20 and then multiply the result by the period of the timer. This should give me the period of the input signal... So my question is can the PIC handle the following code:
timer_time = (((0xFF)*(overflow_acc) + TMR0)*(1/0.000064));
signal_period = (timer_time/20);
where 0.000064 is the period of the timer(TMR0)
I'm using the HI-TECH C compiler.
Any help would be great,
Thanks