在线时间21 小时
UID289934
ST金币0
蝴蝶豆0
注册时间2011-5-11
中级会员
- 最后登录
- 2020-12-1
|
楼主 |
发表于 2012-5-14 10:48:48
|
显示全部楼层
a0a.1 0b0c
RE:为什么程序一直停在stm32f10x_exit.c中的判断中断程序中
下面是我的外部中断的程序
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB| RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, ENABLE);
//启动AFIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; // 抢占优先级别1
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //响应优先级别1
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource15);/*将EXTI线15连接到PA15*/
EXTI_InitStructure.EXTI_Line = EXTI_Line15; /* 将中断映射到中断/事件源Line15 */
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; /* 中断模式 */
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;/* 上升沿触发 */
EXTI_InitStructure.EXTI_LineCmd = ENABLE; /* 中断使能,即开中断 */
EXTI_Init(&EXTI_InitStructure);
void EXTI15_10_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line15)!=RESET)
{
EXITFlag=1;
GPIO_SetBits(GPIOB,GPIO_Pin_13);
GPIO_SetBits(GPIOB,GPIO_Pin_12);
EXTI_ClearITPendingBit(EXTI_Line15);
EXTI->IMR &= 0x0000;
}
} |
|