问题: U0IER寄存器不能初始化,不能赋值,我想产生发送中断,数据能发送,但不能产生中断,查看后发现U0IER始终是0,为什么?CPSR已设置好,在AXD中强行修改U0IER后,继续运行则能产生中断。 周工能否指教?
串口初始化程序如下: void uart0_config(void) { uint16 ui1; // baudrate uart0_baudrate = 9600; // 8/n/1,dlab=1 U0LCR = 0x83; ui1 = Fpclk/(uart0_baudrate*16); U0DLL = ui1%256; U0DLM = ui1/256; // 0--> dlab U0LCR = 0x03; // fifo U0FCR = 0x81; // p0.0 set as txd,01-->pinsel0<1:0> // p0.1 set as rxd,01-->pinsel0<3:2> PINSEL0 |= 0x01; // interrupt vic // uart0 --> irq VICIntSelect = 0; // uart0 isr VICVectAddr0 = (uint32)uart0isr; // uart0 --> slot0 VICVectCntl0 = 0x26; // enable uart0 VICIntEnable = 0x40; // interrupt // THRE enable U0IER = 0x02; // enable uart0 PCONP |= 0x08; } |