Datasheet

Section 11 Timer V
Rev. 2.00 Sep. 23, 2005 Page 146 of 444
REJ09B0068-0200
11.5.2 Pulse Output with Arbitrary Pulse Width and Delay from TRGV Input
The trigger function can be used to output a pulse with an arbitrary pulse width at an arbitrary
delay from the TRGV input, as shown in figure 11.10. To set up this output:
1. Set the CCLR1 and CCLR0 bits in TCRV0 so that TCNTV will be cleared by compare match
with TCORB.
2. Set the OS3 to OS0 bits in TCSRV so that the output will go to 1 at compare match with
TCORA and to 0 at compare match with TCORB.
3. Set the TVEG1 and TVEG0 bits in TCRV1 and set TRGE to select the falling edge of the
TRGV input.
4. Set the CKS2 to CKS0 bits in TCRV0 and the ICKS0 bit in TCRV1 to select the desired clock
source.
5. After these settings, a pulse waveform will be output without further software intervention,
with a delay determined by TCORA from the TRGV input, and a pulse width determined by
(TCORB – TCORA).
Counter cleared
H'FF
TCORA
TCORB
H'00
TRGV
TMOV
Compare match A
Compare match B
clears TCNTV and
halts count-up
Compare match B
clears TCNTV and
halts count-up
Compare match A
TCNTV value
Time
Figure 11.10 Example of Pulse Output Synchronized to TRGV Input