FTM0_SC = FTM_SC_PS(0) | FTM_SC_CLKS(1);//not enable the interrupt mask,select system clock,上升模式
//divide by 1 50MHz
FTM0_MODE &= ~3; //BIT0 FTM Enable
FTM0_MODE |= 0x04;
FTM0_OUTMASK &= ~3; //0 Channel output is not masked. It continues to operate normally.
FTM0_COMBINE=0; //Function for Linked Channels (FTMx_COMBINE)
FTM0_OUTINIT=0;
FTM0_EXTTRIG=0; //FTM External Trigger (FTMx_EXTTRIG)
FTM0_POL=0; //Channels Polarity (FTMx_POL)
//0 The channel polarity is active high.
//1 The channel polarity is active low.
FTM0_INVCTRL=0; //反转控制
FTM0_SWOCTRL=0; //软件输出控制F TM Software Output Control (FTMx_SWOCTRL)
FTM0_PWMLOAD=0; //FTM PWM Load
//BIT9: 0 Loading updated values is disabled.
//1 Loading updated values is enabled.
FTM0_CNTIN=0; //Counter Initial Value
FTM0_MOD=5000; //Modulo value,The EPWM period is determined by (MOD - CNTIN + 0x0001)
//PMW频率=50000000/5000=5000HZ
FTM0_C0V=0; //设置 the pulse width(duty cycle) is determined by (CnV - CNTIN).
FTM0_C1V=0; //设置 the pulse width(duty cycle) is determined by (CnV - CNTIN).
FTM1_CNT=0; //只有低16位可用
//PMW频率=50000000/5000=5000HZ
FTM2_SC = FTM_SC_PS(7) | FTM_SC_CLKS(1);//not enable the interrupt mask,select system clock,上升模式
//divide by 128 195312.5Hz
FTM2_MODE &= ~3; //BIT0 FTM Enable
FTM2_OUTMASK &= ~3; //0 Channel output is not masked. It continues to operate normally.
FTM2_COMBINE=0; //Function for Linked Channels (FTMx_COMBINE)
FTM2_OUTINIT=0;
FTM2_EXTTRIG=0; //FTM External Trigger (FTMx_EXTTRIG)
FTM2_POL=0; //Channels Polarity (FTMx_POL)
//0 The channel polarity is active high.
//1 The channel polarity is active low.
FTM2_INVCTRL=0; //反转控制
FTM2_SWOCTRL=0; //软件输出控制F TM Software Output Control (FTMx_SWOCTRL)
FTM2_PWMLOAD=0; //FTM PWM Load
//BIT9: 0 Loading updated values is disabled.
//1 Loading updated values is enabled.
FTM2_CNTIN=0; //Counter Initial Value
FTM2_MOD=8000; //Modulo value,The EPWM period is determined by (MOD - CNTIN + 0x0001)
//PMW频率=195312.5/4000=50HZ
FTM2_C0V=610;//545~675
}