Searching \ for '[PIC]: mains syncronizing' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'mains syncronizing'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: mains syncronizing'
2002\03\20@062549 by Vasile Surducan

flavicon
face
Good day/morning/night gentlemans.

I have a question which may be defined as FAQ.
I have to synchronize a zero cross main signals with an output nibble on
both rising and falling edge.
I have done this in hardware using one 4093 and a few resistors,
capacitors and one zenner for detection and a 74ls373 for command.
I'm not sure if the best choice on a PIC will be to use rb0 as zero
cross detection interrupt. The nibble must be outputed
synchronously with the rising edge of the mains signal and shutted off
after a desired time period on the falling edge of the same signal.
I think also interrupt on change could satisfy this request but I want to
know other opinions.
The PIC will be 16F628.

Thank you in advance and have a happy day.

Vasile

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\20@083418 by Ted Mawson

flavicon
face
Vasile,

If you dropped the voltage sufficiently you could detect a rise/fall
above/below zero with 2 diodes but you'd probably have to limit/clamp the
voltages.  Then use one rising and one falling trigger pulse to generate
RB0/RB1 interrupts.  The interrupt routine would then simply read in Port B
and depending whether bit 0 or bit 1 was set would indicate the positive or
negative going zero-cross.

Ted Mawson

{Original Message removed}

2002\03\20@090736 by Olin Lathrop

face picon face
> I have a question which may be defined as FAQ.
> I have to synchronize a zero cross main signals with an output nibble on
> both rising and falling edge.
> I have done this in hardware using one 4093 and a few resistors,
> capacitors and one zenner for detection and a 74ls373 for command.
> I'm not sure if the best choice on a PIC will be to use rb0 as zero
> cross detection interrupt. The nibble must be outputed
> synchronously with the rising edge of the mains signal and shutted off
> after a desired time period on the falling edge of the same signal.
> I think also interrupt on change could satisfy this request but I want to
> know other opinions.
> The PIC will be 16F628.

If I understand you right, you want to set an output on the rising zero
crossing of the power line and reset the output some specified time period
after the falling zero crossing.

Since the power line frequency is very stable and predictable, you probably
don't even need to look at the falling zero crossing unless the timing
relative to it is VERY tight.  Using the RB0 interrupt followed by timing
should be fine.  The only thing to watch out for is the phase shift
introduced by the filtering and scaling of the power line to get to RB0
(220V AC is a bit much for the protection diodes ;-o).  This should be
repeatable so should not be hard to account for.

If you really want to be fancy, use the CCP module in capture mode.  This
will allow you to measure the power line period very accurately and always
know where you are within a power cycle.  I did something like this once for
spinning LEDs.  The CCP module was used to catch timer 1 at a fixed point in
the revolution, which allowed very accurate measurment of the period.  I
then used timer 0 to time the pixels around the circle.  Worked very well.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\20@100927 by Chris Loiacono

flavicon
face
I think I comprehend most of this....it sounds like you are working on an
X10 thing perhaps, which causes me to ask a couple of questions first, If I
may....

> I have to synchronize a zero cross main signals with an
> output nibble on
> both rising and falling edge.

Meaning that you need to output 2x per cycle or once?

> I have done this in hardware using one 4093 and a few resistors,
> capacitors and one zenner for detection and a 74ls373 for command.

First, I can assume (I hate that word!) that there is no isolation from the
mains because none is mentioned - so what protects the zener, the 4093 &
perhaps the 628 from line (mains)spikes? I know this is not the area you are
inquiring about, but without covering this base, the choice of pin for ZC
int may be insignificant.


> I'm not sure if the best choice on a PIC will be to use rb0 as zero
> cross detection interrupt.

I would think you would have to use the highest priority int source in order
to synchronize closely, but then, If I am not mistaken, you can only have
this respond to either a high or low, depending upon the option register
state. It seems you'll have only one input state for both ZC's with the
hardware you described, so this should work if you don't need to
differentiate the data sent at each 1/2 cycle of the mains.

It seems like a PORTB change int would be burdensome, but might give you the
ability to send data set pairs per cycle, more easily- if you needed such a
thing.


>The nibble must be outputed
> synchronously with the rising edge of the mains signal and shutted off
> after a desired time period on the falling edge of the same signal.

Do you  mean that you only want to send the nibble during a portion of the
positive 1/2 cycle?
(OK, this is a redundant question. Sorry, but I understand pictures better
than text.)
If so, I have found that hardware that differentiates the positive 1/2 cycle
from the negative used with a high-priority interrupt is much easier to work
with. It's still simple hardware, and simpler code. I guess that's why my ZC
hardware is typically different from what you described here....

> I think also interrupt on change could satisfy this request
> but I want to
> know other opinions.

Well, there's mine - which may or may not be valid....
Chris

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\21@021134 by Vasile Surducan

flavicon
face
Thanks to all who replied; Ted, Olin and Chris,
you all gave me good ideas...


On Wed, 20 Mar 2002, Chris Loiacono wrote:

> > I have to synchronize a zero cross main signals with an
> > output nibble on
> > both rising and falling edge.
>
> Meaning that you need to output 2x per cycle or once?

Some time only once ( when the output nibble state remains unchanged a
numbers of mains periods ) other time twice ( the output is unchanged
only one half period of the mains)

>
> > I have done this in hardware using one 4093 and a few resistors,
> > capacitors and one zenner for detection and a 74ls373 for command.
>
> First, I can assume (I hate that word!) that there is no isolation from the
> mains because none is mentioned - so what protects the zener, the 4093 &

There is no isolation, and will not be any isolation for 628 either,
except a resistor lo limit the mains ( input divisor is 230 K + 10K to ground,
in parallel with 10K is a 5v1 zenner )
With nibble i'm firing some triacs ( no problem here )

{Quote hidden}

With the structure I've mention both alternance zero crossing are sensed.
( with a small derivating circuit R+C and then another trigger, 3 gates
from 4093 are used )

{Quote hidden}

 Thanks, Vasile

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\03\21@091209 by Chris Loiacono

flavicon
face
Vasile:

Just a quick thought:

A local designer was hired to develop an AC controller recently. He ignored
all the advice on isolation, and followed a hardware plan according to one
of microchip's app notes for a circuit that input directly to a PIC pin. The
Ap note stated that the internal diodes would protect the PIC, yet he said
after the fact that he went throuh a box of PICs, all being wasted by simple
line noise & spikes.

Have you used the direct-coupled ZC circuit before without such problems?
Perhaps you have figured something out that is unique...

Chris
>

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...