21.6.5 Software Start One-Shot Mode
In One-Shot mode the timer resets and the ON bit is cleared when the
timer value matches the PRx period value. The ON bit must be set by software to start
another timer cycle. Setting MODE[4:0] = 01000
selects One-Shot mode which is illustrated in Figure 21-7. In the example, ON is controlled by BSF
and BCF
instructions. In the first case, a BSF
instruction sets ON and the counter
runs to completion and clears ON. In the second case, a BSF
instruction
starts the cycle, BCF
/BSF
instructions turn the counter
off and on during the cycle, and then it runs to completion.
When One-Shot mode is used in conjunction with the CCP PWM operation the PWM pulse drive starts concurrent with setting the ON bit. Clearing the ON bit while the PWM drive is active will extend the PWM drive. The PWM drive will terminate when the timer value matches the CCPRx pulse width value. The PWM drive will remain off until software sets the ON bit to start another cycle. If the software clears the ON bit after the CCPRx match but before the PRx match then the PWM drive will be extended by the length of time the ON bit remains cleared. Another timing cycle can only be initiated by setting the ON bit after it has been cleared by a PRx period count match.