I am currently trying to use PWM to control a servo motor that requires approximately a 0.5-2ms pulse every 20ms. This would also require a resolution of at least 0.01ms.
Sorry, but the PWM is designed for power control (motor speed etc.), it's not really suitable for servo control - it's usually just done in software, as it's not a very critical item to do.
I am currently trying to use PWM to control a servo motor that requires approximately a 0.5-2ms pulse every 20ms. This would also require a resolution of at least 0.01ms.
Sorry, but the PWM is designed for power control (motor speed etc.), it's not really suitable for servo control - it's usually just done in software, as it's not a very critical item to do.
I hate to disagree with you again Nigel but I think the PWM module is a perfect candidate anytime you need a pulse or signal with very low resolution, in this case 10-usecs...
In this application you won't get a 20.0-msec period directly from the PWM module but it would be relatively easy to produce a 1.0-msec PWM period with 1.0-usec resolution (use prescaler 4:1 and PR2 d'250') and use an Interrupt Service Routine that programs CCPR1L with a 500-usec (50%) to 2000-usec (200%) duty cycle spread between two 1.0-msec PWM periods and a 0.0-usec (00%) duty cycle for another eighteen 1.0-msec PWM periods... This would produce a "look no hands" 20-msec Interrupt driven Servo output on the CCP1 pin and Main would simply need to update one variable with a value of 500, 510, 520, up to 2000, to change the pulse width output...