STM903K3的UART1问题:发送数据可以,而且用示波器可以看到发送出的波形,但接收部分就是进入不了中断
相关程序块如下所示:
void uart_init(void)
{
UART1_CR1 = 0x00;
UART1_CR2 = 0x00;
UART1_CR3 = 0x00;
UART1_BRR2 = 0x02;
UART1_BRR1 = 0x68; //16000000/9600 = 0x0682
UART1_CR2 = 0x2c;
//CLK_PCKENR1 = 0x04;
}
void UART3_sendchar(unsigned char c)
{
while((UART1_SR & 0x80)==0x00);
UART1_DR=c;
}
@far @interrupt void UART1_Recv_IRQHandler (void)
{
unsigned char ch;
ch=UART1_DR;
nop();
return;
}
以下是UART1中段映射部分:
{0x82, NonHandledInterrupt}, /* irq14 */
{0x82, NonHandledInterrupt}, /* irq15 */
{0x82, NonHandledInterrupt}, /* irq16 */
{0x82, NonHandledInterrupt}, /* irq17 */
{0x82, UART1_Recv_IRQHandler}, /* irq18 */
{0x82, NonHandledInterrupt}, /* irq19 */
{0x82, NonHandledInterrupt}, /* irq20 */ |