if you interface AC, PWM will be useless anyways, you'll need to use a Interrupt to detect the zero crossing and play with your output delays within your ISR.

Your main program may assign delay to your output.

Probably also doable to do everything in a tight loop.. but i tend to say it could be a killer situation.