C-59

REGISTERS
WG_COMPx
WG_COMP
x
x
= 1–3
Address:
Reset State: 1FC2H,1FC4H,1FC6H
0000H
The phase compare (WG_COMP
x
) register controls the duty cycle of each phase. Write a value to
each phase compare register t o specify the length of time t hat the associated outputs wil l remain
asserted.
Changing the WG_RELOAD value changes both the carrier period and the duty cycle because the
outputs remain asserted for a constant length of time, while the counte r takes long er to cycle . To
change the carrier period without changing the duty cycle, you must propor tio nall y change both
WG_RELOAD and WG_COMP
x
at the same time, immediately after the interrupt.
15 0
Compare
Bit
Number Function
15:0 Compare
These bits determine the len gth of time that the associated out puts are asserted.
Use the following formulas to calculate output assertion tim e and duty cycle.
where:
TOUTPUT = total time output is asserted, in µs
FXTAL1 = input frequency on XTAL1 pin, in MHz
multiplier
= 4 for center-aligne d modes; 2 for edg e-aligned modes
WG_RELOAD = 16-bit WG_RELOAD value WG_COMP
x
WG_COMP
x
= 16-bit WG_COMP
x
value WG_RELOAD
TOUTPUT
multiplier
WG_COMPx×
FXTAL1
-----------------------------------------------------------------
=
Duty Cycle WG_COMPx
WG_RELOAD
-------------------------------------- 100%×=