time measurement with Pic16F84

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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

Re: time measurement with Pic16F84
On 29 Jul 2003 07:02:33 -0700, snipped-for-privacy@su.sabanciuniv.edu (yusuf)

Quoted text here. Click to load it

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.)


Re: time measurement with Pic16F84
Robert Scott ESCRIBIO


Quoted text here. Click to load it

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


Re: time measurement with Pic16F84
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?

Re: time measurement with Pic16F84
On 30 Jul 2003 01:18:19 -0700, snipped-for-privacy@su.sabanciuniv.edu (yusuf)

Quoted text here. Click to load it

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.)


Site Timeline