
R01UH0336EJ0102 Rev.1.02
Page 933 of 1538
Jul 17, 2014
V850E2/PG4-L
Section 16 TPBA
16.5.4
Basic Operation Example
Overview
A PWM signal is output from the TPBnO pin according to the PWM period set
in the TPBAnCMP0 register and duty cycle set in the TPBAnBUF00 to
TPBAnBUF63 registers.
Prerequisites
• Select 16 bits × 64 patterns mode or 8 bits × 128 patterns mode by setting
TPBAnDPS.
• Set the duty cycle to TPBAnBUF00 to TPBAnBUF63.
• Set the number of patterns to TPBAnCMP1.
Functional
description
Set the PWM period, the number of patterns, duty cycle, and level to be output.
Set TPBAnTS.TPBSnTS0 = 1 (or input a synchronous start trigger) to start
incrementing the timer counter value.
The TPBnO output is set to the active level at the same time the counting
begins. TPBAnCNT1 is incremented, and points to the address of the buffer in
which the subsequent duty value is stored.
The output is set to the inactive level by the match of the 16-bit counter and the
TPBAnBUFm buffer register (TPBAnCB2).
The duty value is then transferred from TPBAnBUFm to the buffer register
(TPBAnCB2) by the match of the 16-bit counter and the TPBAnCMP0 buffer
register (TPBAnCB0). Then, TPBAnCNT1 is incremented, and a period-
matched detection interrupt (INTTPBAnIPRD) is generated. The TPBnO
output is set to the active level after one count clock.
During counting, a duty-cycle-matched detection interrupt (INTTPBAnIDTY) is
generated by the match of the 16-bit counter and the buffer register
(TPBAnCB2) of TPBAnBUFm.
A number-of-patterns matched detection interrupt (INTTPBAnIPAT) is
generated by the match of the 7-bit counter and the TPBAnCMP1 buffer
register (TPBAnCB1).