47
AT89/83EB5114
4311C–8051–02/08
PWM Unit 1 (PWMU1) The PWM unit 1 allows to generate precise pulse width modulation with variable duty
cycle and frequency.
The PWMU1 consists of a dedicated 16 bits auto reload counter/timer which serves as a
time base for the generation of an independent PWM signal.
Its clock input can be programmed to count any one of the following signals:
Peripheral clock, CkIdle
Timer 1 overflow
External input on W1CI (P4.2)
The PWMU1 timer/counter shares two external I/O. These pins are listed below. If a port
is not used for the PWMU1, it can still be used for standard I/O.
PWMU1 Timer
The PWMU1 timer is a 16-bit timer (See
Figure 20). The timer count source is deter-
mined from the W1CPS1 and W1CPS0 bits in the W1CON register (See
Table 34) and
can be programmed to run at:
Peripheral clock, CkIdle
Timer 1 overflow
External input on W1CI (P4.2)
The output frequency depends on the timer source and also on the W1F Registers. The
timer/counter counts from zero up to a value loaded via SW1F registers. Each time the
counter is higher or equal to the SW1F shadow registers value, W1C registers are auto-
matically reloaded with zero. If the W1UP bit is set, the shadow SW1F registers is
reloaded with the contents of W1F registers when W1C overtakes. This allows to pre-
Note:
If the PWMU1 is Off (W1R bit in W1CON not set), the contents of W1FH and W1FL are
automatically copied on the shadow registers SW1FH and SW1FL. This allows to charge
the correct comparison values in order to have the desired frequency as soon as the
PWM is turned on.
PWMU1 Component
External I/O Pin
16-bit Counter
W1CI (P4.2)
16-bit Module 0
W1M0 (P3.5)