
S3C880A/F880A
PWM and CAPTURE
12-7
PWM0–PWM1
The S3C880A/F880A pulse width modulation (PWM) module has two 14-bit PWM circuits (PWM0 and PWM1).
The 14-bit PWM circuits have the following components:
— 14-bit counter with 3-bit prescaler (an 8-bit counter with 6-bit extension is used for 14-bit output resolution)
— 8-bit comparator and extension cycle circuit
— 8-bit reference data registers (PWM0, PWM1)
— 6-bit extension data registers (PWM0EX, PWM1EX)
— PWM output pins (PWM0, PWM1)
The PWM0 and PWM1 circuits are enabled by the PWMCON register (F8H, set 1, bank 0).
PWM COUNTER
The PWM counter is a 14-bit increasing counter comprised of a lower byte counter and an upper byte counter.
To determine the PWM module's base operating frequency, the lower byte counter is compared to the PWM data
register value. In order to achieve higher resolutions, the lower six bits of the upper byte counter can be used to
modulate the "stretch" cycle. To control the "stretching" of the PWM output duty cycle at specific intervals, the
6-bit extended counter value is compared with the 6-bit value (bits 2–7) that you write to the module's extension
register.
PWM DATA AND EXTENSION REGISTERS
Two PWM (duty) data registers, located in set 1, bank 0, determine the output value generated by each 14-bit
PWM circuit. PWM0 and PWM1 are read/write addressable.
— 8-bit data registers PWM0 (F4H) and PWM1(F6H)
— 6-bit extension registers PWM0EX (F5H) and PWM1EX (F7H) of which only bits 2–7 are used
To program the required PWM output, you should load the appropriate initialization values into the 8-bit data
registers (PWM0, PWM1) and the 6-bit extension registers (PWM0EX, PWM1EX). To start the PWM counter, or
to resume counting, you should set PWMCON.5 to "1".
A reset operation disables all PWM output. The current counter value is retained when the counter stops. When
the counter starts, counting resumes at the retained value.
PWM CLOCK RATE
The timing characteristics of both 14-bit output channels are identical, and are based on the maximum 8-MHz
CPU clock frequency. The 2-bit prescaler value in the PWMCON register determines the frequency of the
counter clock. You can set PWMCON.6 and PWMCON.7 to divide the CPU clock frequency by 1 (non-divided),
2, 3, 4, 5, 6, 7, or 8.
Because the maximum CPU clock rate for the S3C880A/F880A microcontrollers is 8 MHz, the maximum base
PWM frequency is 31.25 kHz (8 MHz divided by 256). This assumes a non-divided CPU clock.