如题,我的代码是调用STM提供的固件库,可不止为何进不了中断?
void main()
{
CLK_Config(); //CLK 16MHz
UART_Config();
// motorInit();
// initI2C();
// initAFD();
// LensInitial();
// delayMs(100);
/* Enable general interrupts */
enableInterrupts();
while (1) {
// hs_test();
}
}
void UART_Config(void)
{
/* Deinitializes the UART1 and UART3 peripheral */
UART2_DeInit();
/* UART1 and UART3 configuration -------------------------------------------------*/
/* UART1 and UART3 configured as follow:
- BaudRate = 9600 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Receive and transmit enabled
- UART1 Clock disabled
*/
/* Configure the UART1 */
UART2_Init((uint32_t)115200, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO,
UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE);
/* Enable UART1 Transmit interrupt*/
// UART2_ITConfig(UART2_IT_TXE, ENABLE);
/* Enable UART1 Receive interrupt */
UART2_ITConfig(UART2_IT_RXNE_OR, ENABLE);
UART2_Cmd(ENABLE);
}
@far @interrupt void UART2_RX_IRQHandler(void)
{
/* Read one byte from the receive data register */
RxBuffer1[IncrementVar_RxCounter1()] = UART2_ReceiveData8();
UART2_SendData8(IncrementVar_RxCounter1());
if (GetVar_RxCounter1() == RxBufferSize1)
{
/* Disable the UART1 Receive interrupt */
//UART2_ITConfig(UART2_IT_RXNE_OR, DISABLE);
clearReceBuf();
}
}
INTERRUPT_HANDLER(UART2_RX_IRQHandler,21);
extern void _stext(); /* startup routine */
struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext}, /* reset */
{0x82, NonHandledInterrupt}, /* trap */
{0x82, NonHandledInterrupt}, /* irq0 */
{0x82, NonHandledInterrupt}, /* irq1 */
{0x82, NonHandledInterrupt}, /* irq2 */
{0x82, NonHandledInterrupt}, /* irq3 */
{0x82, NonHandledInterrupt}, /* irq4 */
{0x82, NonHandledInterrupt}, /* irq5 */
{0x82, NonHandledInterrupt}, /* irq6 */
{0x82, NonHandledInterrupt}, /* irq7 */
{0x82, NonHandledInterrupt}, /* irq8 */
{0x82, NonHandledInterrupt}, /* irq9 */
{0x82, NonHandledInterrupt}, /* irq10 */
{0x82, NonHandledInterrupt}, /* irq11 */
{0x82, NonHandledInterrupt}, /* irq12 */
{0x82, NonHandledInterrupt}, /* irq13 */
{0x82, NonHandledInterrupt}, /* irq14 */
{0x82, NonHandledInterrupt}, /* irq15 */
{0x82, NonHandledInterrupt}, /* irq16 */
{0x82, NonHandledInterrupt}, /* irq17 */
{0x82, NonHandledInterrupt}, /* irq18 */
{0x82, I2C_IRQHandler}, /* irq19 */
{0x82, NonHandledInterrupt}, /* irq20 */
{0x82, UART2_RX_IRQHandler}, /* irq21 */
{0x82, NonHandledInterrupt}, /* irq22 */
{0x82, NonHandledInterrupt}, /* irq23 */
{0x82, NonHandledInterrupt}, /* irq24 */
{0x82, NonHandledInterrupt}, /* irq25 */
{0x82, NonHandledInterrupt}, /* irq26 */
{0x82, NonHandledInterrupt}, /* irq27 */
{0x82, NonHandledInterrupt}, /* irq28 */
{0x82, NonHandledInterrupt}, /* irq29 */
};
各位有遇到此种问题吗?麻烦指点啦,谢谢!
|
|