![](http://datasheet.mmic.net.cn/130000/ML66Q517-NGA_datasheet_5009273/ML66Q517-NGA_218.png)
ML66517 Family User’s Manual
Chapter 10
3-Phase PWM Function
10 – 4
10.3.1 Description of 3-Phase PWM Registers
(1) 3-phase PWM counter (PW3C)
The 3-phase counter (PW3C) is a 16-bit up-down-counter. Bit 2 (PW3CSEL) of 3-phase PWM control
register 1 (PW3CON1) selects whether the counter operates as an up-counter or as an up-down-counter.
If operating as an up-counter, when the value of PW3C matches the value of the 3-phase PWM cycle
register (PW3CYR), PW3C is reset to 0000H and then resumes counting upward.
If operating as an up-down-counter, when the value of PW3C matches the value of the 3-phase PWM cycle
register (PW3CYR), the up-counting operation changes to down-counting. Underflow of the counter causes
the down-counting operation to change to up-counting. At that time, PW3C consecutively repeats the
counter value of 0000H twice and then starts counting upward.
The counter can be checked during operation to determine whether it is operating as an up-counter or
down-counter with bit 4 (PW3CST) of 3-phase control register 1 (PW3CON1).
For details regarding operation of PW3C, refer to the following section 10.4.1.1, “3-Phase PWM Counter
Operation”.
The program can read from and write to PW3C. If written to, or when reset, the up-count state is set.
When reset (
RES signal input, execution of a BRK instruction, overflow of the watchdog timer, opcode
trap), PWC3 becomes 0000H.
(2) 3-phase PWM cycle register (PW3CYR), 3-phase PWM cycle buffer register (PW3CYBFR)
The 3-phase PWM cycle register
(PW3CYR) is a 16-bit register that sets the 3-phase PWM cycle.
PW3CYR is double buffered with the 3-phase PWM cycle buffer register (PW3CYBFR). The value desired
to be set at the next load timing is input and stored in PW3CYBFR. PW3CYR is constantly compared to the
value of the 3-phase counter (PW3C).
If PW3C is operating as an up-counter, when the value of PW3C matches the value of PW3CYR, the value
of PW3CYBFR is loaded into PW3CYR.
If operating as an up-down-counter, when underflow of PW3C occurs, the value of PW3CYBFR is loaded
into PW3CYR.
The program can read from and write to PW3CYBFR, however, PW3CYR cannot be directly accessed.
While the 3-phase PWM counter (PW3C) is halted, the same value written to PW3CYBFR will also be
written to PW3CYR.
When reset (
RES signal input, execution of a BRK instruction, overflow of the watchdog timer, opcode
trap), PW3CYR and PW3CYBFR become 0000H.
(3) U-phase, V-phase, and W-phase duty setting registers (PW3UR, PW3VR, PW3WR),
U-phase, V-phase, and W-phase duty setting buffer registers (PW3UBFR, PW3VBFR, PW3WBFR)
The U-Phase, V-Phase, and W-Phase Duty Setting Registers (PW3UR, PW3VR, PW3WR) are 16-bit
registers that set the PWM duty value for each phase of the 3-phase output. These registers are double
buffered with the U-Phase, V-Phase, and W-Phase Duty Setting Buffer Registers (PW3UBFR, PW3VBFR,
PW3WBFR). Collectively, these registers are called the duty setting registers (PW3nR: n = U, V, W) and
the duty setting buffer registers (PW3nBFR: n = U, V, W). The value desired to be set at the next load
timing is input and stored in PW3nBFR. The value of PW3nR is constantly compared to the value of the
3-phase counter (PW3C).
Depending upon the setting of bits 2 and 3 (CRLD0, CRLD1) of 3-phase PWM control register 0
(PW3CON0), when the 3-phase PWM counter (PW3C) matches the 3-phase PWM cycle register
(PW3CYR) or when underflow of the 3-phase PWM counter (PW3C) occurs, the value of PW3nBFR is
loaded into PW3nR.