Interfacing To Power Lines in BoostC and Chameleon compilers programming Posted March 11, 2008 · Report reply Well, what I wanna do is control a triac for light dimming. So I need to know when the power line crosses zero. I don't need a very high accuracy, 100 µs delay will be ok. But I don't want the interrupt to occur at the peak value of the sine curve nor the interrupt occurring at very different times if the sine curve is going down or up. So using a transformer to get a 9v sine curve is not acceptable because (50Hz) : Going from 0 to 1 needs 2v (TTL) => t = arcsin( 2 / 9 )/( 2 * pi * 50 ) = 0.7 ms later Going from 1 to 0 needs 0.8v (TTL) => t = arcsin( 2 / 9 )/( 2 * pi * 50 ) = 0.3 ms earlier This leads to a 1 ms different between two interrupts, on a 50Hz signal that is 10%, it's too much.