Click this link:

Zero-Crossing-Concept-Using-Optocoupler-GPIO-Change-Int-and-DT-s-Instant-Interrupt