首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

STM32文档中关于NVIC寄存器说明的位置

STM32文档中关于NVIC寄存器说明的位置

要使用STM32,需要各种文档,其中有(以STM32F103RBT6为例):
st官方资源地址:http://www.st.com/internet/mcu/product/164487.jsp
1、datasheet:http://www.st.com/internet/com/T ... HEET/CD00161566.pdf
2、REFERENCE MANUALS:http://www.st.com/internet/com/T ... NUAL/CD00171190.pdf
3、ERRATA SHEETS:http://www.st.com/internet/com/T ... HEET/CD00190234.pdf
4、STM32F10x standard peripheral library:http://www.st.com/internet/com/S ... x_stdperiph_lib.zip
ARM官方:
5、Cortex-M3 Technical Reference Manual Revision r1p1:http://infocenter.arm.com/help/t ... tex_m3_r1p1_trm.pdf
6、ARMv7M Architecture Reference Manual:http://infocenter.arm.com/help/i ... ddi0403c/index.html
非官方的:
The Definitive Guide to the ARM Cortex-M3(中文名:Cortex-M3 权威指南),虽然非官方,但很权威
下面,我们看看关于NVIC寄存器的描述,都在哪些手册里面有提到
在使用STM32F10x standard peripheral library写有关于stm32中断的程序的时候,需要开启某个特定中断的控制位,除了对应外设的寄存器之外,还需要设置NVIC的相关寄存器的对应位。例如:

/******  STM32 specific Interrupt Numbers *********************************************************/  WWDG_IRQn                   = 0,      /*!< Window WatchDog Interrupt                            */  PVD_IRQn                    = 1,      /*!< PVD through EXTI Line detection Interrupt            */  TAMPER_IRQn                 = 2,      /*!< Tamper Interrupt                                     */  RTC_IRQn                    = 3,      /*!< RTC global Interrupt                                 */  FLASH_IRQn                  = 4,      /*!< FLASH global Interrupt                               */  RCC_IRQn                    = 5,      /*!< RCC global Interrupt                                 */  EXTI0_IRQn                  = 6,      /*!< EXTI Line0 Interrupt                                 */  EXTI1_IRQn                  = 7,      /*!< EXTI Line1 Interrupt                                 */  EXTI2_IRQn                  = 8,      /*!< EXTI Line2 Interrupt                                 */  EXTI3_IRQn                  = 9,      /*!< EXTI Line3 Interrupt                                 */  EXTI4_IRQn                  = 10,     /*!< EXTI Line4 Interrupt                                 */  DMA1_Channel1_IRQn          = 11,     /*!< DMA1 Channel 1 global Interrupt                      */  DMA1_Channel2_IRQn          = 12,     /*!< DMA1 Channel 2 global Interrupt                      */  DMA1_Channel3_IRQn          = 13,     /*!< DMA1 Channel 3 global Interrupt                      */  DMA1_Channel4_IRQn          = 14,     /*!< DMA1 Channel 4 global Interrupt                      */  DMA1_Channel5_IRQn          = 15,     /*!< DMA1 Channel 5 global Interrupt                      */  DMA1_Channel6_IRQn          = 16,     /*!< DMA1 Channel 6 global Interrupt                      */  DMA1_Channel7_IRQn          = 17,     /*!< DMA1 Channel 7 global Interrupt                      */    NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn;    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;    NVIC_Init(&NVIC_InitStructure);
而NVIC_Init()这个函数:

/**  * @brief  Initializes the NVIC peripheral according to the specified  *         parameters in the NVIC_InitStruct.  * @param  NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains  *         the configuration information for the specified NVIC peripheral.  * @retval None  */void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct){  uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;    /* Check the parameters */  assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));  assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));    assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));      if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)  {    /* Compute the Corresponding IRQ Priority --------------------------------*/        tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08;    tmppre = (0x4 - tmppriority);    tmpsub = tmpsub >> tmppriority;    tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;    tmppriority |=  NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;    tmppriority = tmppriority << 0x04;            NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;        /* Enable the Selected IRQ Channels --------------------------------------*/    NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);  }  else  {    /* Disable the Selected IRQ Channels -------------------------------------*/    NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);  }}
返回列表