You obviously have a death wish.
The 16F84 has no A/D... and even if it did, it wouldn't help you.
The attached schematic might increase your life expenctancy (or that of your PICs). C1 is a 10nF 1kV Disc Ceramic (good for 110-240vAC). It's there to limit the current going through IC1 which is an opto isolator like Cosmo's K1010. D1 a 1N4007 is there to stop the reverse-bias voltage killing the opto's LED emitter. The PIC's pin needs a pull-up to +Vdd, or use one of the weak-pull-up's on PortB. Add your own Fuses (if required and as appropriate to your application) on the AC Input line. 50mA is more than adequate.
The PIC will see a pulse at the frequency of your AC supply. Check for it using COUNT or PULSIN or whatever method you prefer. No Pulse, No AC. I use this method (or variations of it) to detect AC Supply Phase Failure, Fuses Blown etc etc.
Bookmarks