高级会员

- 积分
- 745
- 金钱
- 745
- 注册时间
- 2016-1-20
- 在线时间
- 78 小时
|
发表于 2016-4-27 14:28:17
|
显示全部楼层
void LocaProtect_Exti(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_DeInit();
EXTI_InitStructure.EXTI_Line = EXTI_Line11;
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 = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI15_10_IRQHandler(void)
{
TIM_SetCompare4(TIM2,0);
GPIO_ResetBits(GPIOB, GPIO_Pin_2);
Control_Reg |= 0x0001;
EXTI_ClearITPendingBit(EXTI_Line11);
}
这是我写的外部中断11的。用的是L151
|
|