
14 8-bit OSC1 Timer (T8OSC1)
14-8
EPSON
S1C17003 TECHNICAL MANUAL
14.8 PWM output
The 8-bit OSC1 timer can generate a PWM signal in accordance with the compare data and PWM duty data
settings and output it from the TOUT4 (P37) pin.
Output pin setting
The PWM output pin (TOUT4) also acts as a pin (P37) for a general-purpose input/output port. In the default
state, this pin is set as a general-purpose input/output port pin. To use it as a PWM output pin, change the
function by setting the value 3 in the P37MUX (D7-6/P3_PMUX register).
 P37MUX: P37 Port Function Select Bit in the P3 Port Function Select (P3_PMUX) Register (D7-6/0x52a7)
PWM waveform control
The PWM waveform frequency can be set by the compare data register (0x50c2) (see Section 14.5). The duty
ratio can be adjusted by the PWM duty data register (0x50c5).
The timer outputs a Low level signal until the counter value matches the value of the PWM duty data register.
When the counter value exceeds the value of the PWM duty data, the output pin changes to High. Once the
counter counts up to the compare data register value, the counter is reset and the output pin returns to Low.
Figure 14.8.1 shows the output waveform.
Input clock
T8ORUN
Counter value
Duty match signal
Compare match signal
TOUT4 output
1 2 3 4 5 0
0
1 2 3 4 5 0 1 2 3
2 3
4 5 0 1
(when T8OSC1_DUTY = 3 and T8OSC1_CMP = 5)
Figure 14.8.1 PWM output waveform
Precautions
(1) When using the timer output, set the following: PWM duty data
≥ 0, compare data ≥ 1. The minimum
setting value is 0 for PWM duty data and 1 for compare data. The timer output cycle is 1/2 of the input
clock.
(2) When the PWM duty data is set greater than the compare data, only the compare match signal will be
generated. No duty match signal will be generated. In that case, the TOUT4 output is fixed to Low.