Hi,
It depends on the zero cross detector circuit. Of course, you need to write code to detect zero cross, but the amount of code to be written depends on the detector circuit being used.
Have you decided which circuit to use? eg. You could use something like this:
**broken link removed**
or something from **broken link removed**
There are tons of circuits available, both isolated and non-isolated.
Using any of the above circuits, you would require to sense a logic change of state to detect zero crossing. You could use interrupts which would make the sensing better and likely to not be missed.
Use the external interrupts module and INT0, INT1 or INT2.
Hope this helps.
Tahmid.