Zero crossing detection with PIC16F877A
Zero crossing detection is very important, especially in power control circuits employing thyristors. I have come across many people struggling with zero crossing detection with PIC microcontroller and thus they cannot fire triacs or SCRs as required. So, here I have explained a simple method of detecting zero crossing with PIC16F877A, employing only two or three resistors, a bridge rectifier and an optocoupler for the hardware portion of zero cross detection. The PIC 16F877A detects the zero crossing using the RB0/INT external interrupt function. I have explained how the zero cross is detected and how the PIC acts upon detection, below. Fig. 1 - Schematic, zero crossing signal and RD0 signals --------------------------------------------------------------------------------------------------------- Here is the code for PIC16F877A: (You can download the source file from https://rapidshare.com/files/604474700/ZeroCrossing.c ) -------------------------------------------------...