选用的是stm32F103VET6,外面加了一个adc,接到了PB1上。采样率为1KHz。可是问题出现了:当初始化完成之后,能够看到进入中断函数(中断函数中加入了led灯),可是这时候主函数却不运行,不知道为什么啊
void EXTI1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO ,ENABLE); //´ò¿ªGPIOBµÄÍâÉèʱÖÓ
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; //Ñ¡Ôñ²Ù×÷µÄIO¿Ú
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //¸¡¿ÕÊäÈë
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO¿Ú×î´óÊä³öËÙÂÊ
GPIO_Init(GPIOB, &GPIO_InitStructure); //Íê³É³õʼ»¯
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource1); //Á¬½ÓEXTI Line1µ½PB1
EXTI_ClearITPendingBit(EXTI_Line1);
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; //ÖжÏģʽ
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //ϽµÑØ´¥·¢
EXTI_InitStructure.EXTI_Line = EXTI_Line1 ;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure); //³õʼ»¯EXTI
}
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* #define VECT_TAB_FLASH
#ifdef VECT_TAB_RAM
NVIC_SetVectorTable(NVIC_VectTab_RAM , 0x0);
#else
NVIC_SetVectorTable(NVIC_VectTab_FLASH , 0x0);
#endif */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //ÓÅÏȼ¶×éÅäÖÃΪ1
NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; //ÇÀÕ¼ÓÅÏȼ¶Îª0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //×ÓÓÅÏȼ¶Îª2
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
大家有遇到过这种情况吗?
|