Section 10 Programmable Pulse Generator (PPG)
10.4.2
Sample Setup Procedure for Normal Pulse Output
Figure 10.4 shows a sample procedure for setting up normal pulse output.
TPU setup
PPG setup
TPU setup
Figure 10.4 Setup Procedure for Normal Pulse Output (Example)
Rev.2.00 Jun. 28, 2007 Page 402 of 666
REJ09B0311-0200
Normal PPG output
Select TGR functions
Set TGRA value
Set counting operation
Select interrupt request
Set initial output data
Enable pulse output
Select output trigger
Set next pulse
output data
Start counter
No
Compare match?
Yes
Set next pulse
output data
[1]
Set TIOR to make TGRA an output
compare register (with output disabled).
[2]
Set the PPG output trigger cycle.
[1]
[3]
Select the counter clock source with bits
[2]
TPSC2 to TPSC0 in TCR. Select the
counter clear source with bits CCLR1 and
CCLR0.
[3]
[4]
Enable the TGIA interrupt in TIER. The
DTC can also be set up to transfer data to
[4]
NDR.
[5]
[5]
Set the initial output values in PODR.
[6]
Set the bits in NDER for the pins to be
[6]
used for pulse output to 1.
[7]
Select the TPU compare match event to
[7]
be used as the output trigger in PCR.
[8]
Set the next pulse output values in NDR.
[8]
[9]
Set the CST bit in TSTR to 1 to start the
TCNT counter.
[9]
[10] At each TGIA interrupt, set the next
output values in NDR.
[10]