void SYSTEM_Initialize(void)
{
CLOCK_Initialize();
PIN_MANAGER_Initialize();
PWM1_16BIT_Initialize();
PWM2_16BIT_Initialize();
PWM3_16BIT_Initialize();
INTERRUPT_Initialize();
}
在初始化函数里,也自动给添加进去了各个PWM发生器的初始化函数
直接按照名字写好一组,修改另外两组就行了
PWM1_16BIT_WritePeriodRegister(10000);
PWM1_16BIT_SetSlice1Output1DutyCycleRegister(5000);
PWM1_16BIT_SetSlice1Output2DutyCycleRegister(5000);
PWM1_16BIT_LoadBufferRegisters();
PWM2_16BIT_WritePeriodRegister(10000);
PWM2_16BIT_SetSlice1Output1DutyCycleRegister(5000);
PWM2_16BIT_SetSlice1Output2DutyCycleRegister(5000);
PWM2_16BIT_LoadBufferRegisters();
PWM3_16BIT_WritePeriodRegister(10000);
PWM3_16BIT_SetSlice1Output1DutyCycleRegister(5000);
PWM3_16BIT_SetSlice1Output2DutyCycleRegister(5000);
PWM3_16BIT_LoadBufferRegisters();
太方便了。
|