time measurement with Pic16F84

I am using PIC 16F84 for my project and I need to measure the time interval between two rising edges of input signal. Input signal is like a clock but the period of the signal is not so stable. So basically I want to measure the time between the rising edges that comes one after another, and also measure several of them and take the average of many to obtain an average clock period. I know how to handle external interrupt (RB0/INT), but I dont know how to manipulate it and measure some time interval in it. Also I want to use the measured time intervals in comparisons so that I can do other things according to that time. (I use a 4 MHz crystal oscillator.) any suggestions will work. regards

Yusuf

Reply to
yusuf
Loading thread data ...

Read up on Input Capture functions (called CCP modules in PIC-talk).

-Robert Scott Ypsilanti, Michigan (Reply through newsgroups, not by direct e-mail, as automatic reply address is fake.)

Reply to
Robert Scott

Robert Scott ESCRIBIO

The 16f84 doesn't possess CCP.

A possibility is use the interrupt RB0 to start and stop the count of the TMR0, Then this count to interpret it as the time. good bye

Reply to
=?iso-8859-4?Q?"Tio=5F[J]"_?

You told me to read about the ccp modules for 16F84 but these modules are available in 16F628.Did you mean to use 16F628 instead of 16F84?

Reply to
yusuf

I didn't realize that the 16F84 didn't have any CCP modules. In that case you will have to read a free-running counter clocked by instruction cycles in response to an interrupt from an external source. Subtract the two readings and you have the time between edges. Unfortunately, this method is subject to inaccuracies caused by variable interrupt latency. But if you never disable the interrupt, this latency variability will be at most one instruction cycle time, because you might be interrupting a one-cycle instruction or a two-cycle instruction. Except for that, the software method is potentially just as accurate as the Input Capture method.

-Robert Scott Ypsilanti, Michigan (Reply through newsgroups, not by direct e-mail, as automatic reply address is fake.)

Reply to
Robert Scott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.