void NVIC_Configuration(void) {NVIC_InitTypeDef NVIC_InitStructure; /* 配置NVIC为优先级组1 */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//高2位为抢占优先级,低2位为响应优先级//中断1设置优先级 /* 配置中断源:按键1 */ NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //配置为EXTI0通道/* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;/* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;/* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 //中断2设置优先级 /* 配置中断源:DMA1 */ NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn; //配置为DMA1_Channel1_IRQn通道 /* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; /* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; /* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 } 这个设置中,EXTI0中断抢占优先级高于DMA1中断,所以EXTI0会打断DMA1中断,这样的写法对不对? |
OK
SysTick_Config(0x01000000);
NVIC_Configuration();
先设置SysTick再设置NVIC会导致SysTick定时中断进不去?