Do it at your peril! I have been burt by this one badly. Remember that even if you use a zener on the input at some stage at start up the pin will be outside the supply voltage range. It is better to not drive the pin directly at all, i.e. have a buffer of some kind. Obviously not another ic that can be affected by voltages outside the supply range, use a transistor cct or better, an opto. George ----- Original Message ----- From: "Mohit Mahajan" To: Sent: Sunday, October 26, 2003 6:01 PM Subject: [PIC]: PIC <-> 240VAC > Hi, > > Refering to Microchip's AN521, it shows a PIC connected to AC supply > line (of "several hundred volts") using just a 5 megaohm resistor in > series in between. Safety issues apart, it looks too simple to be true. > Is this enough to detect a zero-crossing (eg. for a PIC based triac > dimmer)or should I put two clamping diodes on the pin detecting the > zero-crossing? I'm using a PIC16F870. I've read the manual and I believe > it doesn't have protection diodes in its i/o pins. > > --->|---o Vdd > R | > 240VAC o-------/\/\/\---o----o---------o PIC i/p > 5 M | | > | ---|<---o Vss > \ > R / > 100K \ > | > o > Gnd > > Btw, the PIC in my dimmer is powered from a transfomer on the same AC > line (and bridge rectifier) so both the commons are going to be same. > > Off topic, sitting here in India I can only guess what is "HOT OUT" and > "HOT IN"... its LINE and NEUTRAL, right? Pity we don't have such > interestingly graphic lingo down here. > > Mohit. > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.