You do not need full wave rectification for zero-crossing detection. The circuit shown on p3, FIG3 of AN236 works fine for zero crossing. The appnote even details the inaccuracies inherent in the circuit, saying...You'll find similar inaccuracies in most methods for zero-crossing detection. Their calculations are for 120VAC/60Hz. You'll need to adjust for 220V/50Hz (and maybe use a larger current limiting resistor).On a rising edge, RB0 will go high about 64 µS after the zero-crossing, and on a falling edge, it will go low about 16 µS before the zero-crossing.
One possible cause of flicker is failing to compensate for inaccurate zero crossing detection.
You can ignore the X10 communications circuitry and code but I suggest you study the code used for the triac dimmer circuit in AN236 (p6) or in the referenced PICREF-4 Reference Design, “PICDIM Lamp Dimmer for the PIC12C508”. The Microchip engineers frequently know what they are doing.![]()
Bookmarks