CHAPTER 8 PROGRAMMABLE PULSE GENERATOR (PPG) TIMER
8.3.5
Activation of Multiple Channels Using the General
Control Register
If multiple activation triggers are specified using the GCN1 register, multiple channels of
PPG timer can be activated at the same time.
This section provides an example of multiple-channel activation by software using the
GCN2 register.
■ Activation Setting Procedure
1. Set a cycle in the PCSR register.
2. Set a duty in the PDUT register.
•
Be sure to perform setting in order given above.
3. Specify the sources of trigger input for the channels to be activated using the GCN1 register.
•
In this case, use the GCN2 register with the initial settings.
(ch0 → EN0, ch1 → EN1, ch2 → EN2, and ch3 → EN3)
•
4. Set required values in the control status registers for the channels to be activated as follows:
CNTE: 1 → Timer operation enabled
•
STGR: 0 → No activation (because the channel is activated according to GCN2)
•
MDSE: 0 → PWM operation
•
RTRG: 0 → Reactivation disabled
•
CSK1 and CSK0: 00 → Count clock = Φ
•
PGMS: 0 → Output not masked
•
(Bit 8: 0 → Any setting allowed, since this is an unused bit)
•
EGS1 and EGS0: 01 → Activation at rising edge
•
IREN: 1 → Interrupt request enabled
•
IRQF: 0 → Clearing of interrupt source
•
IRS1 and IRS0: 01 → Generation of interrupt request when counter borrow occurs
•
OSEL: 0 → Ordinary polarity
•
5. Write data to the GCN2 register to generate activation triggers.
To activate channels 0 and 1 at the same time with the above settings, write "1" to the EN0 and EN1
bits of the GCN2 register. A rising edge is generated, and pulse signals are outputted from PPG0 and
PPG1.
To use the 16-bit reload timer for activation:
Specify the 16-bit reload timer as a trigger input source in the GCN1 register in step 3), and activate the
16-bit reload timer in place of the GCN2 register in step 5).
320