Chris, the attached application note could be of interest to you.
Al.
Chris, the attached application note could be of interest to you.
Al.
All progress began with an idea
Hi,
Which PIC do you plan to use ? Any PIC with an External interrupt works here. Would you be sensing the mains directly (120VAC / 60Hz) or you would be using a step down transformer for the sensing the Zero Cross.
Regards
Sougata
Thanks to everyone who replied. Sounds like this will be a "go" then. I didn't hear anyone hitting the brakes, so I'll give it a shot. Maybe I can even try out using Darrell's instant interrupts to get the quickest response.
Since the only purpose of the zero crossing detect is to turn on/off two sets of IGBTs, I intend to interface the mains directly to the PIC and let the internal clamping do its thing.
Now, I'll start looking for some code snippets to give me a place to start...
Should I use the "port change" feature in the PICs that offer that?
I was thinking that, simply, the first half "positive" side of the sine wave would be detected as "on" and the "negative half would be "off."
Now for the embarrassing newbie question: I understand how to detect an interrupt change, but how do I test whether voltage is swinging toward positive or toward negative (zero)? I assume capture/compare has something to do with it. I don't yet know how to do that, but it is time to jump in.
I hope that question makes sense.
Thank you all for your input.
Chris
I read up a bit on DT's wonderful instant interrupts. How cool is that!? I had heard of it here often but now I see just how powerful that thing is!
I understand that an interrupt can be generated from the comparator using "CMP_INT -- Comparator Interrupt" from his include.
So, conceptually, it is simply comparing to zero volts. Whenever that changes (not zero anymore,) then interrupt. Am I on the right path here?
OR maybe simply using the port change interrupt will work? Hmm, it needs to see a certain voltage before it is considered "on" though, huh?
Here is what I need it to do:
As V rises above zero, generate an interrupt. Then I'll tell the PIC to turn on a pin.
As V falls to zero, generate an (different?) interrupt. Then I'll tell the PIC to turn the above pin off and turn on a different one.
I'm just confused about the rising/falling or comparing part of it.
Anyone have a snippet related? (Is that kind of shameless asking allowed?)
Thanks everyone.
Chris
The Coolest (greatest) possible extension to PBP Two different version for the x14 and x16 architecture. Very Pro very powerful......Free. DT has done a lot, lot hard work for us.
The comparator generates an interrupt whenever there is a state change.
I intended to give you one. That is why asked for the PIC you would be using.
Regards
Sougata
Ah, very good.
I will be working on an 18f4550. I have one here and it should offer what I need.
Thanks SO much in advance.
Chris
Bookmarks