use HPWM instead.

You set the frequency, set the duty cyle (motor speed)... and you're done. It runs in background with the internal CCP module and it will run as long as you want... or power failure (duh....).