STM32文档中关于NVIC寄存器说明的位置
扫描二维码
随时随地手机看文章
要使用STM32,需要各种文档,其中有(以STM32F103RBT6为例):
st官方资源地址:http://www.st.com/internet/mcu/product/164487.jsp
1、datasheet:http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00161566.pdf
2、REFERENCE MANUALS:http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00171190.pdf
3、ERRATA SHEETS:http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/ERRATA_SHEET/CD00190234.pdf
4、STM32F10x standard peripheral library:http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f10x_stdperiph_lib.zip
ARM官方:
5、Cortex-M3 Technical Reference Manual Revision r1p1:http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337e/DDI0337E_cortex_m3_r1p1_trm.pdf
6、ARMv7M Architecture Reference Manual:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0403c/index.html
非官方的:
The Definitive Guide to the ARM Cortex-M3(中文名:Cortex-M3 权威指南),虽然非官方,但很权威
下面,我们看看关于NVIC寄存器的描述,都在哪些手册里面有提到
在使用STM32F10x standard peripheral library写有关于stm32中断的程序的时候,需要开启某个特定中断的控制位,除了对应外设的寄存器之外,还需要设置NVIC的相关寄存器的对应位。例如:
/******STM32specificInterruptNumbers*********************************************************/WWDG_IRQn=0,/*!
而NVIC_Init()这个函数:
/***@briefInitializestheNVICperipheralaccordingtothespecified*parametersintheNVIC_InitStruct.*@paramNVIC_InitStruct:pointertoaNVIC_InitTypeDefstructurethatcontains*theconfigurationinformationforthespecifiedNVICperipheral.*@retvalNone*/voidNVIC_Init(NVIC_InitTypeDef*NVIC_InitStruct){uint32_ttmppriority=0x00,tmppre=0x00,tmpsub=0x0F;/*Checktheparameters*/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){/*ComputetheCorrespondingIRQPriority--------------------------------*/tmppriority=(0x700-((SCB->AIRCR)&(uint32_t)0x700))>>0x08;tmppre=(0x4-tmppriority);tmpsub=tmpsub>>tmppriority;tmppriority=(uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority<NVIC_IRQChannelSubPriority&tmpsub;tmppriority=tmppriority<<0x04;NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel]=tmppriority;/*EnabletheSelectedIRQChannels--------------------------------------*/NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel>>0x05]=(uint32_t)0x01<<(NVIC_InitStruct->NVIC_IRQChannel&(uint8_t)0x1F);}else{/*DisabletheSelectedIRQChannels-------------------------------------*/NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel>>0x05]=(uint32_t)0x01<<(NVIC_InitStruct->NVIC_IRQChannel&(uint8_t)0x1F);}}