this helps a bit, but i already have the hardware side figured out, it's not AC LINE that i need zero crossing detection, i have a signal that
i've filtered down to under 5v pp i need to detect zero crossing on.
what i'm not quite figuring out is if a pic pin shows high at around 1.8v (i think that's what it is) how is is that you can detect a zero
crossing ?
thanks !
dld
On Tue, 6 Nov 2001 11:20:30 -0500, Douglas Butler wrote:
>I would start with Microchip's application note AN521. It mostly covers
>hardware issues.
>
>Sherpa Doug
>
>> {Original Message removed}
I think in AN521 they assume that 1.8V is close enough to 0v for a 120V
sine wave. For a low level zero crossing you will probably need a
comparator. If you just have 0V & 5V supplies you can AC couple the
signal to a level within your range. Some PICs have built in
comparators but the 877 is not one of them.
Yes, you can do it with the RB0/INT pin. I did this on the DM406 at http://www.dovesystems.com . Here we add a second pair of diodes on the
secondary of the power transformer (the first pair of diodes are doing a
full wave rectification with the center tap of the transformer secondary
grounded). The two cathodes of this second pair of diodes are tied
together with a pull-down resistor to ground. Then a current limit
resistor to the RB0 pin. Set that pin to generate an interrupt on a
negative edge. It will interrupt a little before the zero crossing.
Be careful with internal pull-ups on port B, as the current limit
resistor and the pull-down have to be small enough to pull the pin down.
I'd now probably turn off internal pull-ups and use an external pull-up
on pins that needed one (not the INT pin). It'd be nice if Microchip made
the internal pull-up be driven by the output latch so it could be enabled
pin by pin.
Once the zero cross generates an interrupt, we reset a timer and use the
capture/compare register to generate another interrupt to turn on triacs
at the appropriate time.
> I'm sure in my surfing i've seen that you can do a zero crossing
> detector on a pic, possibly with PB0 ? I'm using a 16F877.
>
> Anybody have links on how to set this up ?
>
>
> Thanks,
>
> DLD
>
> --
> http://www.piclist.com#nomail Going offline? Don't AutoReply us!
> email listservKILLspammitvma.mit.edu with SET PICList DIGEST in the body
>
>
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
dl.http://www.juno.com/get/web/.
On Tue, 6 Nov 2001 10:35:20 -0600 David Dunn <EraseMEddunnspam_OUTTakeThisOuTTCAINTERNET.COM>
writes:
> this helps a bit, but i already have the hardware side figured out,
> it's not AC LINE that i need zero crossing detection, i have a
> signal that
> i've filtered down to under 5v pp i need to detect zero crossing on.
>
> what i'm not quite figuring out is if a pic pin shows high at around
> 1.8v (i think that's what it is) how is is that you can detect a
> zero
> crossing ?
>
> thanks !
>
When you say zero cross detect, everyone thinks AC line and dimmers! As
I recall, when used as an INT input, the pin has a schmitt trigger input
with a Vil of about 0.2Vdd or 1V (looking at my 18c452 datasheet, but
they're all similar). You COULD drive this with an external comparator to
detect zero cross. A bit less accurate, and with a lower input
resistance, you could put the INT pin at the center of a voltage divider
with the high side of the divider going to +5V and the low side going to
your 5Vpp signal. Instead of working the voltage divider formula
backwards, I go back to Ohm's law. Let's use, say, 10K for the resistor
to +5V. The current through this resistor is (+5V-1V)/10K = 400uA. We'll
have the same current through the bottom resistor, and the bottom of the
bottom resistor is at 0V. So R=V/I = 1V/400uA = 2.5k .
When the bottom of the bottom resistor is at 0V, the INT input will be
at 1V, causing the interrupt IF the input is going low. Note that this
would only detect Negative zero crossings. Positive zero crossings would
require the PIC be set to detect positive zero crossings AND require an
input threshold of 0.8Vdd.
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
dl.http://www.juno.com/get/web/.