
ML610Q421/ML610Q422/ML610421 User’s Manual
Chapter 11 PWM
11 – 8
11.3 Description of Operation
The PWM0 counter registers (PW0CH, PW0CL) are set to an operating state (P0STAT is set to “1”) on the first falling
edge of the PWM clock (P0CK) that are selected by the PWM0 control register 0 (PW0CON0) when the P0RUN bit of
PWM0 control register 1 (PW0CON1) is set to “1” and increment the count value on the 2nd falling edge.
When the count value of PWM0 counter registers and the value of the PWM0 duty buffer (PW0DBUF) coincide, the
PWM flag (P0FLG) is set to “0” on the next timer clock falling edge of P0CK.
When the count value of PWM0 counter registers and the value of the PWM0 period buffer (PW0PBUF) coincide, the
PWM flag (P0FLG) is set to “1” on the next falling edge of P0CK and PWM0 counter registers is set to “0000H” and
incremental counting continues. At the same time, the value of the PWM0 duty register (PW0DH, PW0DL) is
transferred to the PWM0 duty buffer (PW0DBUF) and the value of PWM0 period register (PW0PH, PW0PL) to the
PWM0 period buffer (PW0PBUF).
When the P0RUN bit is set to “0”, PWM0 counter registers stop counting after counting once the falling of the PWM
clock (P0CK). Confirm that PW0CH and PW0CL are stopped by checking that the PnSTAT bit of the PWM0 control
register 1 (PW0CON1) is “0”. When the P0RUN bit is set to “1” again, PWM0 counter registers restarts incremental
counting from the previous value on the falling edge of P0CK.
To initialize PWM0 counter registers to “0000H”, perform write operation in either of PW0CH or PW0CL. At that time,
P0FLG is also set to “1”. When data is written in the PWM0 duty register (PW0DH, PW0DL) during count stop
(P0RUN is in a “1” state), the data is transferred to the PWM0 duty buffer (PW0DBUF) and when data is written in the
PWM0 period register (PW0PH, PW0PL), the data is transferred to the PWM0 period buffer (PW0PBUF).
The PWM clock, the point at which an interrupt of PWM0 occurs, and the logic of the PWM output are selected by
PWM0 control register 0 (PW0CN0).
The period of the PWM0 signal (TPWP) and the first half duration (TPWD) of the duty are expressed by the following
equations.
T
PWP
=
PW0P + 1
P0CK (Hz)
T
PWP
=
PW0D + 1
P0CK (Hz)
PW0P:
PWM0 period registers (PW0PH, PW0PL) setting value (0001H to 0FFFFH)
PW0D:
PWM0 duty registers (PW0DH, PW0DL) setting value (0000H to 0FFFEH)
P0CK:
Clock frequency selected by the PWM0 control register 0 (PW0CON0)
Summary of Contents for ML610421
Page 1: ...ML610Q421 ML610Q422 ML610421 User s Manual Issue Date Feb 9 2015 FEUL610Q421 06...
Page 15: ...Chapter 1 Overview...
Page 44: ...Chapter 2 CPU and Memory Space...
Page 49: ...Chapter 3 Reset Function...
Page 53: ...Chapter 4 MCU Control Function...
Page 69: ...Chapter 5 Interrupts INTs...
Page 93: ...Chapter 6 Clock Generation Circuit...
Page 110: ...Chapter 7 Time Base Counter...
Page 121: ...Chapter 8 Capture...
Page 129: ...Chapter 9 1 kHz Timer 1kHzTM...
Page 135: ...Chapter 10 Timers...
Page 160: ...Chapter 11 PWM...
Page 172: ...Chapter 12 Watchdog Timer...
Page 180: ...Chapter 13 Synchronous Serial Port...
Page 195: ...Chapter 14 UART...
Page 216: ...Chapter 15 I2 C Bus Interface...
Page 231: ...Chapter 16 NMI Pin...
Page 237: ...Chapter 17 Port 0...
Page 246: ...Chapter 18 Port 1...
Page 252: ...Chapter 19 Port 2...
Page 259: ...Chapter 20 Port 3...
Page 270: ...Chapter 21 Port 4...
Page 282: ...Chapter 22 Port A...
Page 290: ...Chapter 23 Melody Driver...
Page 304: ...Chapter 24 RC Oscillation Type A D Converter...
Page 327: ...Chapter 25 Successive Approximation Type A D Converter...
Page 338: ...Chapter 26 LCD Drivers...
Page 371: ...Chapter 27 Battery Level Detector...
Page 378: ...Chapter 28 Power Supply Circuit...
Page 381: ...Chapter 29 On Chip Debug Function...
Page 384: ...Appendixes...
Page 435: ...Revision History...