For what it is worth, you could put an extra diode between the output of your power supply rectifier and the filter capacitor. This gives you an un-filtered DC output at the junction between the rectifier and the extra series diode. the frequency will be either mains frequency for a half-wave rectifier or twice mains frequency if the rectifier is a full-wave kind. The peak voltage will be what ever the rectifier's output voltage is so you will need to clamp it, but it will be referenced to the same ground as the rest of the PIC circuit. One can either use this pulsating signal as a voltage reference to get an idea as to whether the line voltage is correct or take a simpler approach and use the low portion of the signal as a trigger to an interrupt which can be timed from one cycle or half-cycle to the next. If a couple of periods go by without a transition, it may be time to start the UPS. Don't forget that this extra diode will lower the voltage on the high side of the regulator by about .7 volts so there should be a good enough margin so as not to keep the regulator from working correctly. Martin McCormick WB5AGZ Stillwater, OK OSU Center for Computing and Information Services Data Communications Group