21ic问答首页 - KF32A156参考例程将PE0配置PWM捕获,引脚有方波但不进中断
KF32A156参考例程将PE0配置PWM捕获,引脚有方波但不进中断
cj02202024-04-26
#define PE0_CCP19_CH4_PIN GPIOE_SFR, GPIO_PIN_MASK_0
#define PE0_CCP19_CH4_AF9 GPIOE_SFR, GPIO_Pin_Num_0, GPIO_RMP_AF9
{
GPIO_Write_Mode_Bits(PE0_CCP19_CH4_PIN, GPIO_MODE_RMP);
GPIO_Pin_RMP_Config(PE0_CCP19_CH4_AF9);
Ccp_IntConfig_t ccpIntConfig;
ccpIntConfig.ccpInterrupt = CCP_INT_CAPTURE_CH4;
ccpIntConfig.intIndex = INT_T19;
ccpIntConfig.newState = TRUE;
ccpIntConfig.preemption = 4;
ccpIntConfig.subPriority = 0;
CCP_Capture_Mode_Init(CCP19_SFR, CCP_CHANNEL_4, CCP_CAP_RISING_EDGE);
CCP_INT_Config(CCP19_SFR, &ccpIntConfig);
INT_All_Enable(TRUE);
}
void __attribute__((interrupt))_T19_exception (void)
{
if (0U != CCP_Get_Channel_Trigger_INT_Flag(CCP19_SFR, CCP_CHANNEL_4))
{
/* Clear interrupt flag */
CCP_Clear_Channel_INT_Flag(CCP19_SFR, CCP_CHANNEL_4);
}
}
赞0
CCPx_Capture_Mode_init(CCP3_SFR);
GPTIM_Trigger_INT_Enable(T3_SFR, TRUE);
INT_Interrupt_Enable(INT_T3, TRUE);
INT_All_Enable(TRUE);
void __attribute__((interrupt))_T3_exception (void)
{
if (0U != GPTIM_Get_Trigger_INT_Flag(T3_SFR))
{
/* Clear interrupt flag */
GPTIM_Clear_Trigger_INT_Flag(T3_SFR);
}
}
评论
2024-04-26
您需要登录后才可以回复 登录 | 注册