need help in measuring time between two comparator output in PIC microcontroller

Status
Not open for further replies.

kavin_eees

Member level 3
Joined
May 11, 2012
Messages
57
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,843
hi to all
right now am in developing three phase sequence detector using pic16f887 microcontroller. i had tried more methods but unfortunately the results are negative..
finally i planned to use inbuilt comparator in pic16f887 (2 comparators available) . i planned to fed the first two phase signal say R & Y to each comparator , and want to measure the time between the two signals.. the problem is how to measure the time after every raising edge or falling edge between the two comparator output C1OUT & C2OUT?

kindly share your valuable suggestion!
Thanks
kavin. s
 

Hi,

First you need to specify the time between the two events.
And what precision and resolution you expect.

With this we can decide whether a software solution is good, a hardware solution is needed or whether the PIC is not suitable at all.

Klaus
 

"#include includes.h" doesn't sound particularly useful!

I haven't followed the code, as plain text it loses its formatting which makes it difficult to read. You should post it here and wrap it in CODE tags to retain its original appearance.

The principle though is:
1. set up a timer with count rate fast enough for the timing resolution you need.
2. wait for the start output from the first comparator
3. either start the timer (if not used for anything else) or record the present count number.
4. wait for the second comparator output.
5. read the timer. If you started it at step 3 it holds the time value, if it was already running, subtract the value found in step 3 to get the difference.

Brian.
 
hi betwixt and klausst
thanks to all... i finally completed the sequence detection.. using comparator and timer...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…