中断之外部中断
.h"3 #include "key.h"4 #include "misc.h"5 #include "stm32f10x_exti.h"6 7 void RCC_Configration(void)8 {9 SystemInit();10 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);11 RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); //功能复用IO时钟12 }13 14 void GPIO_Configration(void)15 {16 GPIO_LED_Configration();17 GPIO_KEY_Configration();18 }19 20 /*21 *中断配置*22 */23 void EXTI_Configuration(void)24 {25 EXTI_InitTypeDef EXTI_InitStructure;26 27 EXTI_ClearITPendingBit(EXTI_Line0); //清空中断线28 EXTI_ClearITPendingBit(EXTI_Line1);29 EXTI_ClearITPendingBit(EXTI_Line2);30 EXTI_ClearITPendingBit(EXTI_Line3);31 EXTI_ClearITPendingBit(EXTI_Line4);32 EXTI_ClearITPendingBit(EXTI_Line5);33 EXTI_ClearITPendingBit(EXTI_Line6);34 EXTI_ClearITPendingBit(EXTI_Line7);35 36 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);//映射37 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource1);38 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource2);39 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource3);40 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource4);41 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource5);42 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource6);43 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource7);44 45 EXTI_InitStructure.EXTI_Line=EXTI_Line0 EXTI_Line1 EXTI_Line2 EXTI_Line3 EXTI_Line4 EXTI_Line5 EXTI_Line6 EXTI_Line7; //选择中断线46 47 EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt; //设置模式48 EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling; //设置触发方式49 EXTI_InitStructure.EXTI_LineCmd=ENABLE; //使能50 51 EXTI_Init(&EXTI_InitStructure);52 }53 54 void NVIC_Configuration0(void) //优先级设置函数55 {56 NVIC_InitTypeDef NVIC_InitStructure; 57 58 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3); 59 60 NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //选择IRQ通道61 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //抢占优先级设置62 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //次优先级设置63 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 64 NVIC_Init(&NVIC_InitStructure); 65 }66 67 void NVIC_Configuration1(void) 68 {69 NVIC_InitTypeDef NVIC_InitStructure; 70 71 // NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3); 72 73 NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn; 74 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; 75 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; 76 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 77 NVIC_Init(&NVIC_InitStructure); 78 }79 80 void NVIC_Configuration2(void)81 {82 NVIC_InitTypeDef NVIC_InitStructure; 83 84 //
中断外部中 相关文章:
- PIC 定时器中断1+外部中断0(11-21)
- S3C2440内部中断和外部中断(11-19)
- S3C6410中断以及外部中断(11-19)
- STM32F104VG (一)中断与外部中断(11-19)
- S3C内部中断和外部中断(11-13)
- Windows CE 进程、线程和内存管理(11-09)