NVIC_Configuration 中使能SysTick_IRQn

void NVIC_Configuration(void)
{
  NVIC_InitTypeDef NVIC_InitStructure;


#ifdef  VECT_TAB_RAM  
  /* Set the Vector Table base location at 0x20000000 */ 
  NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); 
#else  /* VECT_TAB_FLASH  */
  /* Set the Vector Table base location at 0x08000000 */ 
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   
#endif


  /* Enable the USART1 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

 /* Enable the USART2 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);


#if 1 // add liuxd 
  /* Enable the USART3Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQChannel; // USART3_IRQn; // USART3_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
  #endif


  #if 0 // add liuxd 
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);   //选择分组3  3bits抢占优先级
  NVIC_InitStructure.NVIC_IRQChannel = SysTick_IRQChannel;// SysTick_IRQn;//中断号   
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//抢占优先级   
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;   //子优先级     
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;       //使能中断
  NVIC_Init(&NVIC_InitStructure);
  #endif


}

你可能感兴趣的:(NVIC_Configuration 中使能SysTick_IRQn)