Hi, ShouMin,
I developed an example based on CodeWarrior for mcu and PE, TWR-K20D50M board. The Example can demo how to set the duty cycle and phase shift for FTM0_CH0/CH2/CH4/CH6. Note that only 4 signals can be used if you want to control both phase shift and duty cycle.
Hope it can help you.
you can use the following code to change the duty cycle and phase shift.
void FTM_Init(void)
{
//initialize the FTM0_CnV register
//the FTM modulo is 1000
FTM_PDD_WriteModuloReg(FTM0_DEVICE,1000);
//the FTM0_CH0 rising at FTM0_CNT=0, falling at FTM0_CNT=200
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,0,0);
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,1,200);
//the FTM0_CH0 rising at FTM0_CNT=0, falling at FTM0_CNT=200
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,2,250);
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,3,400);
//the FTM0_CH0 rising at FTM0_CNT=0, falling at FTM0_CNT=200
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,4,500);
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,5,600);
//the FTM0_CH0 rising at FTM0_CNT=0, falling at FTM0_CNT=200
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,6,750);
FTM_PDD_WriteChannelValueReg(FTM0_DEVICE,7,800);
}
BR
XiangJun Rong