void Ex
ti_Init(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_EXTILineConfig(GPIO_PortSourceGPIOE, GPIO_PinSource0);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOE, GPIO_PinSource1);
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);
// EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line = EXTI_Line1; //外部中断1
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //下降沿触发
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init( EXTI_InitStructure);
//外部中断0中断优先级
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init( NVIC_InitStructure);
//外部中断1中断优先级
NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_Init( NVIC_InitStructure);
}
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0) != RESET)
{
EXTI_ClearITPendingBit(EXTI_Line0); //清外部中断0
LED1ON();
delay_s();
LED1OFF();
uart1_trx[uart1_rx] = 0x61;
uart1_rx++;
uart1_rx = 0x3f;
}
}
void EXTI1_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line1) != RESET)
{
EXTI_ClearITPendingBit(EXTI_Line1);//清外部中断1
LED2ON();
delay_s();
LED2OFF();
uart1_trx[uart1_rx] = 0x62;
uart1_rx++;
uart1_rx = 0x3f;
}
}
假如PE0,PE1配置为按键输入
PE0按下时产生的下降沿触发外中断0,那在释放会产生上升沿,会不会触发外中断1?
PE1按下时产生的下降沿会触发外中断0吗?,那在释放会产生上升沿,会不会触发外中断1?
谁能说清楚点啊,谢谢啦,分数都是浮云,解决问题最重要!
望高手解决。外中断1搞错了
// EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line = EXTI_Line1; //外部中断1
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //上升沿触发
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init( EXTI_InitStructure);
其他不变。我要问的是这个,我搞错了,这又会是什么情况
PE0按下时产生的下降沿触发外中断0,那在释放会产生上升沿,会不会触发外中断1?
PE1按下时产生的下降沿会触发外中断0吗?,那在释放会产生上升沿,会不会触发外中断1?