Hello All I am new to programming the Pic. Pic 16c84. I have wrote a program that requires a pulse when mains is at zero. I have used a small circuit using a comparator which does the job but I have read a posting on here about using a 5 meg resistor connected to the input from the mains to detect zero crossing. My questions are :- 1) Is 5 meg ok with 240v 2) Do I connect the Ov rail of cct to Neutral or will Earth be ok. 3) I gather I just test bit for being clear for zero crossing. In case anyone is interested the circuit is for a surge system for a fish tank. It turns on a pump for 30 secs (soft start) then turns it off and turns on another pump for 30 secs. So the zero crossing is required for the soft start. I know this program probably sounds simple to most of you but it was my first attempt at programming and I am quite proud of it. Thanks in advance for any replies to my questions. Cheers Ste