2017.12.15学习总结

  下午学习了中断和外部中断,其中NVIC控制和EXTI控制,NVIC给每个中断赋予先占优先级和次占优先级,NVIC通过优先级分组来分配先占优先级和次占优先级的数量。EXTI负责管理映射到GPIO引脚上的外中断和片内几个集成外设的中断以及软件中断。

NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);


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);

EXTI0_IRQn的值,其实就是EXTI0中断向量在中断向量表中的位置。

你可能感兴趣的:(2017.12.15学习总结)