CHAPTER 7 TIMER/COUNTER FUNCTION
User’s Manual U13850EJ4V0UM
200
Figure 7-27. Timing of Square Wave Output Operation
Count clock
TMn count value
CRn0
INTTMn0
0002H
0001H
0000H
N
−
1
N
N
N
−
1
N
TOn pin output
0002H
0001H
0000H
0000H
Remark
n = 0, 1
7.2.6 Operation to output one-shot pulse
TMn can output a one-shot pulse in synchronization with a software trigger and an external trigger (TIn0 pin input).
(1) One-shot pulse output with software trigger
A one-shot pulse can be output from the TOn pin by setting 16-bit timer mode control register n (TMCn),
capture/compare control register n (CRCn), and 16-bit timer output control register n (TOCn) as shown in Figure
7-28, and by setting bit 6 (OSPTn) of TOCn by software.
By setting OSPTn to 1, the 16-bit timer/event counter is cleared and started, and its output is asserted active at
the count value (N) set in advance to 16-bit capture/compare register n1 (CRn1). After that, the output is
deasserted inactive at the count value (M) set in advance to 16-bit capture/compare register n0 (CRn0)
Note
.
Even after the one-shot pulse has been output, TMn continues its operation. To stop TMn, TMCn must be reset
to 00H.
Note
This is an example when N < M. When N > M, the output is assertied active by CRn0 and deasserted
inactive by CRn1.
Caution Do not set OSPTn to 1 while the one-shot pulse is being output. To output the one-shot
pulse again, wait until the current one-shot pulse output is complete.