English
Language : 

W79E825A Datasheet, PDF (97/127 Pages) Winbond – 8-BIT MICROCONTROLLER
W79E825A/824A/823B/822B Data Sheet
23 PULSE-WIDTH-MODULATED (PWM) OUTPUTS
The W79E825 series have four Pulse Width Modulated (PWM) channels, and the PWM outputs are
PWM0 (P0.1), PWM1 (P1.6), PWM2 (P1.7) and PWM3 (P0.0). The initial PWM outputs level
correspondingly depend on the PRHI level set prior to the chip reset. When PRHI set to high, PWM
output will initialize to high after chip reset; if PRHI set to low, PWM output will be initialize to low after
chip reset.
The W79E825 series support 10-bits down counter with cpu clock as its input. The PWM counter
clock, has the same frequency as the clock source FCPU = FOSC. When the counter reaches underflow
it will automatic reloaded from counter register. The PWM frequency is given by: fPWM = FCPU /
(PWMP+1), where PWMP is 10-bits register of PWMPH.1, PWMPH.0 and PWMPL.7~PWMPL.0.
The counter register will be loaded with the PWMP register value when PWMRUN, load and CF are
equal to 1; the load bit will be automatically cleared to zero on the next clock cycle, and at the same
time the counter register value will be loaded to the 10 bits down counter. CF flag is 10-bits down
counter reaches underflow, the CF flag will be cleared by software.
The pulse width of each PWM output is determined by the Compare registers of PWM0L through
PWM3L and PWM0H through PWM3H. When PWM compare register is greater than 10-bits counter
register, the PWM output is low. Load bit has to be set to 1 for alteration of PWMn width. After the
new values are written to the PWMn registers, and if load bit is set to 1, the new PWMn values will be
loaded to the PWMn registers upon the next underflow. The PWM output high pulses width is given
by:
tHI = (PWMP – PWMn+1). Notice, if compare register is set to 000H, the PWMn output will stay at high,
and if compare register is set to 3FFH, the PWMn output will stuck at low until there is a change in the
compare register.
- 97 -
Publication Release Date: February 21, 2008
Revision A9