microchip zerocrossing
I used the voltage from the transformer and fed it directly to a PIC, through a resistor. The PIC input diodes clamp the voltage, the current is limited by the resistor. Got the idea from Microchip's AN521: ww1.microchip.com/downloads/en/AppNotes/00521c.pdf Although, as I said, I did not connect to the AC line directly, but through a 12Vac transformer and a 47K resistor.
Then I wrote a short adjustable delay routine. With that I was able to predict accurately the next zero-crossing. It worked much like a PLL.