-
KF32A单片ECCP5的pwm模式的用法(比较值装载问题)
关于增强型CCP5,配置:请问是不是每次装载比较值都需要重新配置PWM设置。voidcfg_ECCP5(){ECCP_PWM_Mode_Config(ECCP5_SFR,ECCP_PWM_FREE);//PWM自由模式,ECCP_Channel_Output_Mode(ECCP5_SFR,ECCP_CHANNEL_1,ECCP_OUTPUT_COMPLEMENTARY);//互补输出模式ECCP_Channel_Output_Mode(ECCP5_SFR,ECCP_CHANNEL_2,ECCP_OUTPUT_COMPLEMENTARY);//互补输出模式ECCP_Channel_Output_Mode(ECCP5_SFR,ECCP_CHANNEL_3,ECCP_OUTPUT_INDEPENDENT);//独立输出模式ECCP_Channel_Output_Mode(ECCP5_SFR,ECCP_CHANNEL_4,ECCP_OUTPUT_INDEPENDENT);//独立输出模式ECCP_Channel_Shutdown_Signal(ECCP5_SFR,ECCP_CHANNEL_1,ECCP_CHANNEL_SHUTDOWN_FORBID);//禁止自动关断ECCP_Channel_Shutdown_Signal(ECCP5_SFR,ECCP_CHANNEL_2,ECCP_CHANNEL_BKIN_INACTIVE);//使能自动关断,ECCPx_BKIN引脚上的低电平ECCP_Channel_Shutdown_Signal(ECCP5_SFR,ECCP_CHANNEL_3,ECCP_CHANNEL_BKIN_INACTIVE);//禁止自动关断ECCP_Channel_Shutdown_Signal(ECCP5_SFR,ECCP_CHANNEL_4,ECCP_CHANNEL_BKIN_INACTIVE);//使能自动关断,ECCPx_BKIN引脚上的低电平ECCP_PWM_Restart_Enable(ECCP5_SFR,TRUE);//使能自动重启ECCP_PWM_Move_Phase_Enable(ECCP5_SFR,TRUE);//使能移相ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_2,ECCP_PORT_LOW,PIN_INACTIVE);//关闭状态为低电平ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_2,ECCP_PORT_HIGH,PIN_ACTIVE);//关闭状态为高电平ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_3,ECCP_PORT_LOW,PIN_INACTIVE);//关闭状态为低电平ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_3,ECCP_PORT_HIGH,PIN_ACTIVE);//关闭状态为高电平ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_4,ECCP_PORT_LOW,PIN_INACTIVE);//关闭状态为低电平ECCP_Channel_Pin_Ctl(ECCP5_SFR,ECCP_CHANNEL_4,ECCP_PORT_HIGH,PIN_TRISTATE);//关闭状态为三态
2022-03-10 0