Hi Daehyeon,
MJW is right. You should concatenate two 8bit PWM counters into one 16bit.
Example of 16bit PWM initialization:
void PWM0_Init(void)
{
PWM0POL = 0xC0;
PWM0CLK = 0x00;
PWM0PRCLK = 0x01;
PWM0CAE = 0x00;
PWM0CTL = 0x8C;
PWM0CNT67 = 0x0000;
PWM0PER67 = 4000;
PWM0DTY67 = PWMPER67/2;
PWM0E = 0x80;
}
Per RM, the S12ZVC contain two 4-channel 16-bit PWM modules - PWM0 gated from bus clock and PWM1 gated from core clock.
In fact, both modules are 8-channel 8-bit PWM modules, but only odd channels are routed to the external pins. Therefore, we may use only 4 channels from each module configured either as 8bit or 16bit.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------