I want to detect zero crossing of AC mains by using stm8l151kxxx. In referance manual it says there are two comparators for zero cross detection but it doesn't give detailed information about hardware implementation. While I was using other vendor's mcu, I was using two serial connected resistor between mains and mcu. But in this case, there is no protection diodes(clamping diodes) for analog inputs, so I dont know how should I implement hardware. Anybody have done this? Waiting for your help.