Olin, the PIC input parasitic capacitance (somewhere between 5 and 10pF) with a 4.7M will already gave a time constant of 4.7exp6 x 10exp-12 = 50uS. So the high frequencies are rejected from the very begining. A simple low pas filter will be then enough. (1..3mS time constant) However I presume there is another problem there, like an inefficient PIC supply filtering or a bad MCLR via configuration word ... top 10 wishes, Vasile http://surducan.netfirms.com On Mon, 15 Sep 2003, Olin Lathrop wrote: > > The Neutral terminal of the Mains is connected to a PIC input through a > > 4.7M resistor for detecting zero crossings. (Some may consider this > > dangerous, but since the power supply itself makes the whole circuit > > "live", this doesn't make any big difference.) > > You should put some low pass filtering in there. You circuit will detect > the zero crossings of the power line just fine, but it is very susceptible > to noise near the zero crossing. A 5V spike near 0 will cause additional > edges, and 5V is a very small noise spike as power line standards go. I > would use two successive R/C filters to reduce the high frequencies, then > measure the zero crossings. > > Of course now there will be some phase shift. I don't know if this is > acceptable in your application. If the filters aggresively attenuate the > line voltage (you've got plenty to start with), then the phase shift will > be very predictable and quite independent of part value variations. > > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics