![](http://datasheet.mmic.net.cn/130000/ML66Q517-NGA_datasheet_5009273/ML66Q517-NGA_268.png)
ML66517 Family User’s Manual
Chapter 11
PWM Function
11 – 8
16-bit PWM settings
(1) Port 7 mode register (P7IO)
If PWM1OUT is to be used, set bit 7 (P7IO7) to “1” to configure the port as an output.
(2) Port 8 mode register (P8IO)
If PWM3OUT is to be used, set bit 7 (P8IO7) to “1” to configure the port as an output.
(3) Port 7 secondary function control register (P7SF)
If PWM1OUT is to be used, set bit 7 (P7SF7) to “1” to configure the port as a secondary function output.
When PWM is halted, the port is fixed to “1”.
(4) Port 8 secondary function control register (P8SF)
If PWM3OUT is to be used, set bit 7 (P8SF7) to “1” to configure the port as a secondary function output.
When PWM is halted, the port is fixed to “1”.
(5) PWM counters (PWC0, PWC1)
Set these counters with the value at which to start counting. Writing to PWC causes the same value to be
simultaneously and automatically written to PWCY.
(6) PWM cycle register (PWCY)
Set the PWM cycle in PWCY.
(7) PWM registers (PWR01, PWR23)
If PWM1OUT is to be used, set the desired output duty value in PWR01. If PWM3OUT is to be used, set
the desired output duty value in PWR23. Set a value for PWR01 and PWR23 that is larger than the value of
PWCY.
(8) PWM control register 0 (PWCON0)
Setting both bits 5 and 6 (PWCK10 and PWCK11) to “1” cascades the two counters (16-bit mode) so that
overflow of PWM counter 0 (PWC0) is the clock input to PWM counter 1 (PWC1), thereby forming 16-bit
PWM counter (PWC). Bits 1 and 2 (PWCK00 and PWCK01) specify the count clock. Bits 3 and 7
(PWC0OV and PWC1OV) specify the interrupt factor for PWINT0 and PWINT1 interrupt requests.
Leaving bit 4 (PW1RUN) set to “1” allows starting and stopping during the 16-bit mode to be controlled
with only bit 0 (PW0RUN).
(9) PWM control register 1 (PWCON1)
Bit 0 (PWHSM) specifies normal 16-bit mode or high-speed mode. During the high-speed mode, starting
and stopping can be controlled with only bit 4 (PW1RUN) of PWCON0.
[Equation to Calculate 16-Bit PWM Cycle]
f(PWM16) = PWCLK / (65536 – PWCY)
f(PWM16)
: PWM cycle [Hz]
PWCLK
: PWM input clock frequency [Hz]
PWCY
: Value of PWCY (16 bits)