Quote Originally Posted by ardhuru View Post
Instead of feeding the mains to the pic pin, drive an opto like the PC814.

This has 2 LEDs in anti-parallel at the input, so you'd get 2 pulses for each mains cycle, one each for positive and negative. This will also give you a bonus of isolating your circuit from the mains.

Regards,

Anand Dhuru
Thanks for the reply. What resistance values normally goes for the opto side of the PC814 and what should be the wattage of this resistance values. I am @ 240VAC