I almost get it but... What do you mean by 'tics between cycles'? The AC will be both 50 and 60 Hz. John Bellini Product Development, Firmware Technologist > -----Original Message----- > From: Harrison Cooper [SMTP:hcooper@ES.COM] > Sent: Wednesday, May 13, 1998 1:50 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Any good ideas for detecting zero crossing? > Importance: High > > How about this....run the thing as fast as you can. > Count the number of tics between cycles, then divide in half. Or does > the PIC detect at the 90 phase? If I remember right, it looks at the > full cycle. In fact, you should be able to calculate the number of > tics > (knowing the clock and the frequency of the AC), and find a edge and > count the number of clocks till you get there. > > ---------- > From: John Bellini > [SMTP:JBellini@STATPOWER.COM] > Sent: Wednesday, May 13, 1998 2:40 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Any good ideas for detecting > zero crossing? > > I'm not sure, but this may already have come > up > on the list. If so > please direct me to the archive and I will > look > there. However, any > ideas would be great full. > > What I will be having to do is synchronize to > the incoming AC. To do > this I will have to detect RMS voltage, Detect > the zero crossing, > generate the sine wave reference and then > synchronize to the line. > > Any ideas on detecting the zero crossing?À I > want to do it software not > hardware. I've already done it in hardware > using 2 pins on the micro. > I want to do it with 1 pin now. > > John Bellini > Product Development, Firmware Technologist