下面是初始化程序,请大家帮我看看 为什么进不了中断??
void InitUSART0(void) {
AT91C_BASE_PIOA->PIO_PDR = DMX_RXD | DMX_TXD ; //Disables the PIO from controlling the corresponding pin (enables peripheral control of the pin). AT91C_BASE_PIOA->PIO_ASR = DMX_RXD | DMX_TXD; //Assigns the I/O line to the Peripheral A function. AT91C_BASE_PIOA->PIO_BSR = 0; //Assigns the I/O line to the Peripheral B function. //enable the clock of USART AT91C_BASE_PMC->PMC_PCER = 1<<AT91C_ID_US0; //Set the USART mode AT91C_BASE_US0->US_MR = AT91C_US_USMODE_NORMAL | //普通模式 AT91C_US_CLKS_CLOCK & //时钟为MCK ~AT91C_US_SYNC | //异步模式 AT91C_US_PAR_NONE | //无校验 AT91C_US_NBSTOP_1_BIT | //一位停止位 AT91C_US_MODE9 & //9位数据位 ~AT91C_US_OVER //16 倍重采样。OVER=0 ; //write the Timeguard Register AT91C_BASE_US0->US_TTGR = 0; //set baud rate divisor register AT91C_BASE_US0->US_BRGR = BAUD_CD; //((47923200)/(250000x16)) //Enable the RX and TX PDC transfer requests //AT91C_BASE_PDC_US0->PDC_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTEN;
//Enable usart AT91C_BASE_US0->US_CR = AT91C_US_RXEN | AT91C_US_TXEN; // 0x50; //使能接收结束中断&发送结束中断 AT91C_BASE_US0->US_IMR = AT91C_US_ENDRX | AT91C_US_ENDTX ; //在AIC中设置US0中断优先级、中断入口、中断方式 AT91F_AIC_ConfigureIt ( AT91C_BASE_AIC, AT91C_ID_US0, US0_INTERRUPT_LEVEL, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, US0_irq_handler ); //在AIC中使能US0中断 AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_TC0);
} |