Hi Roman, > I believe it's the "ac mains zero crossing detector" > application note that was discussed here on the > list a while back. :o) Well that's different! I misread your original post as supplied from the AC. But I have seen this zero crossing detect in a number of places. It's in two circuits on pages 11 and 89 of "50 things to do with a PIC" by Paul Benford - a 6M8 resistor is connecting GP5 of a PIC12C508 to the "neutral" and a simple capacitor/resistor supply not unlike a circuit one that I have used to supply PICs in a couple of commercial products. In the text he says; "The PIC devices are very good at handling high voltage. The majority of I/O pins have clamping diodes both to Vdd and Vss. This means that any voltage appearing on the I/O greater than the supply or less than ground will be clamped to Vdd or Vss respectively. The instantaneous current rating for these diodes is 20mA. This does not mean that they will be happy sinking that current forever. The maximum continuous current rating is 500uA. Therefore before applying any large voltage to an input ensure that there is a current limiting resistor in series." He then goes on to say; "The value of the input resistor needs to be less than 10Mohms. [he does not explain why] It needs to be high [enough] though to limit the current to less than 50uA. This provides a safety margin of 10 over the maximum continuous rating. The calculations fall out easy with: Vpeak = V2 x 240 = 339.5 Volts Resistance = Vpeak/Ipeak = 339.5 Volts/50 uA = 6.8 MOhms" A similar circuit also appears on page 100 of "The Greatest Little PIC Book" by Gordon Macnee. This circuit has the neutral connected to GP4 of a PIC12C508 via 2 x 4M7 resistors. Also on page 84 of the "PIC Cookbook - Volume 1" by Nigel Gardner and Peter Birnie, a circuit shows Pin RA3 connected to neutral via 2 x 1M resistors. I was quite seriously considering such a technique in my next project. Can I assume that you do not think this is wise? Regards, Sean -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body