Synchronize a PWM to a another Signal with PIC16F18855
I`ve generated a 100Hz PWM with the PIC16F18855. This works well so far.
I`d like to synchronize the PWM with the 50Hz of the mains. I've thought this quite simple with this PIC.
The 50Hz is generated by the Comparator and works well to.
The next step to synchronize was to synchronize the TMR2, wich is the source of the PWM.
T2HLT=0x03; //each edge resets TMR2
T2RST=0x0B; // Source to reset ist CM1OUT
The result is a signal with sporadically missing PWM pulses.
How can I fix this matter?
Thank you in advance.