Greetings!

Having problems generating a clean 50% duty cycle hardware PWM @125KHz using a PIC16F628 with a 20MHz crystal.
The below is from a 2002 Microchip AppNote: (Which specified a 16F628 in the original schematic.)

The drive signal can be generated directly by the PWM
unit on most PIC® microcontrollers such as a
PIC16F627 microcontroller. For a device operating at
20 MHz, one can obtain a 125 kHz signal by setting the
Timer2 prescaler to 1. A period of 8 μs is then obtained
by setting the PR2 register to 39. To get a 50% duty
cycle output, set CCPR1L to 14 and CCP1CON<5:4>
to <0:0>. These settings will ensure a constant carrier.
To modulate the data, one can turn the drive signal on
and off by setting and clearing the CCP1RIL bit.

My interpertation of the above code is:
PR2 = 39 ' A period of 8 µs is then obtained by setting the PR2 register to 39.
CCPR1L = 14 ' To get a 50% duty cycle output, set CCPR1L to 14 and CCP1CON<5:4> to <0:0>.
CCP1CON = %00001100 ' PWM Mode, CCP1CON<5:4> = <0:0>
T2CON = %00000100 ' For a device operating at 20 MHz, one can obtain a 125 kHz signal by setting the Timer2 prescaler to 1.

However, this results in the below:

Name:  F0000TEK.BMP
Views: 344
Size:  76.1 KB



Note that although it is exactly 125.0KHz, it is not symetrical and has an approximate duty cycle of 2.8us/5.2us * 100 = 35%

Although running on an old dev board from Bruce Reynolds, I would prefer to update to a PIC10(LF32x) dev board.
(Or something from melabs.)

Suggestions?

Jay Zebryk, W1JRZ​