@jfhaugh
I have to assume that wherever the OP is that they have 240 volt supply at the mains (probably 230/400 3-phase for the system power) that their utilities also reclose after 3 cycles or so
I notice the OP fill out the location in his/her profile... Canada. Therefore, North American system...
The OP want a code "example" of : if no pulse ( at the ouput of the opto-coupler ) for a lengh of time.... do something ....
Yeah, I also see that the "240" I thought I read was a 24VAC transformer.
They should wait 3 full cycles before assuming the power is out, unless they want to see "power outage" indications all day long. My system picks up an AC line loss after two cycles, and I see a lot of "blips" that were fewer than 5 or 6 cycles in length.
With that in mind, I'd wire up an external crystal for the timer2 oscillator and use the on-chip oscillator for the uPC itself. I don't know how the clock source is determined, so someone else will have to answer that question or tell you that I'm all wet.