In a UPS (Offline I suppose) control your primary task would be to monitor mains for abnormality which includes under/over voltage, blackout/brownout. I suggest sampling the mains voltage at 0.5ms intervals. Also a premature zero-cross is a definite indication of mains failure. While I use PORTB.0 INT for the zero cross in asm you may use Instant Interrupt to make your life easier.

http://www.picbasic.co.uk/forum/showthread.php?t=3251