本帖最后由 yzzly 于 2010-7-16 10:43 编辑
中断初始化时的中断向量xxx_IRQn是如何与xxx_IRQHandler()中断服务函数对应起来的?例如USART1中断:
中断设置函数
void NVIC_Configuration(void)
{
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
中向量USART1_IRQn是如何与stm32f10x_it.c文件内的函数
void USART1_IRQHandler(void)
{
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
/* Read one byte from the receive data register */
RxBuffer1[RxCounter1++] = USART_ReceiveData(USART1);
if(RxCounter1 == NbrOfDataToRead1)
{
/* Disable the USART1 Receive interrupt */
USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
}
}
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
/* Write one byte to the transmit data register */
USART_SendData(USART1, TxBuffer1[TxCounter1++]);
if(TxCounter1 == NbrOfDataToTransfer1)
{
/* Disable the USART1 Transmit interrupt */
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
}
}
}
建立关系?
在51中写中断服务函数时有Interrupt n关键字做说明,使函数与向量一一对应;在DSP中利用语句"PieVectTable.SPIRXINTA =&SPIARXINT_ISR;"把中断服务函数的入口地址付给对应的寄存器,记得ARM中好像也是这样;STM32F系列是个什么样的机制使之一一对应?谢谢! |