View previous topic :: View next topic |
Author |
Message |
Rafaelcl2 Guest
|
Comparator |
Posted: Tue Feb 13, 2007 10:28 am |
|
|
Does anyone know how to use the comparator of pic 16f877?. I need a zero crossing detector , for when a sine wave cross the zero , the Pic starts counting and when another sine wave cross the zero , the pic stops the counter.
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Feb 13, 2007 11:07 am |
|
|
The PIC16F877, doesn't have a comparator module....
The 16F877A does.
The easiest way to do what you want, is probably to wire the output to load a flip-flop, and the output of the second compator to clear it. Then use the output of the flip flop, to gate the sigal to count.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Rick Guest
|
|
Posted: Tue Feb 13, 2007 1:00 pm |
|
|
How do I use the comparator as a zero crossing detector in C , using PIC16f877A?. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Feb 13, 2007 3:36 pm |
|
|
The same way as any comparator. You would need to have the AC voltage 'biased' so that the 'zero' point represents a voltage inside the comparator's range, and then feed this voltage into one input, and the DC voltgae corresponding to the 'zero' level into the other.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Rick Guest
|
|
Posted: Tue Feb 13, 2007 5:50 pm |
|
|
I've never use a comparator before , could you please explain me how it works. I need fist to setup the comparator , using setup_comparator() function . when I choose wich pins are gonna be the input of comparators , is that righ? So how it works , Where do I choose that the comparison is gonna be with 0?. And when the Sine cross the zero , is a output pin(where do I choose it?) gonna turn logic 1?
Thanks so much for you Attention. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
Rick Guest
|
|
Posted: Wed Feb 14, 2007 5:32 pm |
|
|
Which simulator do u guys use to simulate a comparator? I can't find PIC16f877A or other PIC who has a comparator at Proteus. |
|
![](templates/subSilver/images/spacer.gif) |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
|
Posted: Fri Feb 16, 2007 9:42 am |
|
|
Should not a schmitt trigger and a small inexpensive PIC do a zero crossing detector just fine ? |
|
![](templates/subSilver/images/spacer.gif) |
|