I played with this code a little today and it works well....Thanks

Just a few minor changes can give 10 bits PWM resolution.

Change duty var byte to duty var word.

Add the line ECCPR1L = duty >> 2 after ECCP1CON.5 = duty.1.

now the duty cycle can be set from 0 to 1023 instead of 0 to 255.

Bob W.