void main(void)
{
/* System Clocks Configuration */
RCC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();
/* Connect Key Button EXTI Line to Key Button GPIO Pin */
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource2);
/* Configure Key Button EXTI Line to generate an interrupt on falling edge */
EXTI_InitStructure.EXTI_Line = EXTI_Line2;//使用2号中断通道
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;//中断模式
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;//下降沿触发
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Generate software interrupt: simulate a falling edge applied on Key Button EXTI line */
EXTI_GenerateSWInterrupt(EXTI_Line2);//软件模拟一次中断
while (1)
{
}
}