English
Language : 

PIC18LF24K Datasheet, PDF (256/594 Pages) –
PIC18(L)F26/45/46K40
20.6.5 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 20-8. In the example, ON is controlled by BSF
and BCF instructions. In the first case, a BSF instruc-
tion 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 con-
current 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 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.
FIGURE 20-8:
ONE-SHOT MODE TIMING DIAGRAM
Rev. 10-000199B
5/30/2014
MODE
TMRx_clk
PRx
Instruction(1)
BSF
ON
TMRx
0
0b01000
5
BSF
BCF
BSF
12345
0
12
3
45
0
TMRx_postscaled
PWM Duty
Cycle
3
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions
executed by the CPU to set or clear the ON bit of TxCON. CPU
execution is asynchronous to the timer clock input.
 2016 Microchip Technology Inc.
Preliminary
DS40001816C-page 256