Video Sync (genlock) for PICs

In many cases, especially for video overlay operations, it is necessary to synchronize a PIC to some external event (such as horizontal sync pulses).

This circuit uses only one extra part - a D-type flip-flop (such as a 74hc74).  The pic is configured to run an external RC oscillator but the normal pull-up resistor is connected to the output of the 74hc74.  The external sync pulse sets Q high allowing the oscillator to run until the pic sets RA,0.  This stops the processor until the next sync pulse comes along.  This not only locks the clock to the external event but locks the processor cycle as well.  Any video generated with the pic in this way will be 'genlocked' to the original video signal.