產(chǎn)品:CH32V103C8T6
現(xiàn)象:
使用PB0做外部中斷,當(dāng)使用外部脈沖觸發(fā)時(shí)無法EXTI0,手動(dòng)將輸入接地時(shí)可以進(jìn)入;但是將外部脈沖換接至其他端口卻可以正常進(jìn)入對(duì)應(yīng)中斷EXTI5、7。外部中斷外圍電路完全一樣。PB0配置如下
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);//使能GPIOB的時(shí)鐘 /*配置PB0*/ GPIO_InitStruct.GPIO_Mode=GPIO_Mode_IPU;//工作模式:輸入模式 GPIO_InitStruct.GPIO_Speed=GPIO_Speed_2MHz;//最大輸出速度:2MHz GPIO_InitStruct.GPIO_Pin=GPIO_Pin_0;//引腳號(hào) GPIO_Init(GPIOB,&GPIO_InitStruct);//初始化 /*PB0---->EXTI_Line0*/ GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource0);// EXTI_InitStructure.EXTI_Line=EXTI_Line0; EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd=ENABLE; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannel=EXTI0_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=2; NVIC_InitStructure.NVIC_IRQChannelSubPriority=2; NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE; NVIC_Init(&NVIC_InitStructure);
請(qǐng)問如何解決?