This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

如何让串口0 ,映射到P1口上?

修改前:

/****************************************************************
串口初始化函数
****************************************************************/
void InitUART(void)
{
PERCFG = 0x00; //位置1 P0口
P0SEL = 0x0c; //P0_2,P0_3用作串口(外部设备功能)
P2DIR &= ~0XC0; //P0优先作为UART0

U0CSR |= 0x80; //设置为UART方式
U0GCR |= 11;

U0BAUD |= 216; //波特率设为115200
UTX0IF = 0; //UART0 TX中断标志初始置位0
}

修改后:

void InitUART(void)
{
PERCFG = 0x01; //位置2 P1口
P1SEL = 0x30; //P1_4,P1_5用作串口(外部设备功能)
P2DIR = 0X40; //P0优先作为UART1
P2SEL =0x00;
U0CSR |= 0x80; //设置为UART方式
U0GCR |= 11;
U0BAUD |= 216; //波特率设为115200
UTX0IF = 0; //UART0 TX中断标志初始置位0
}

修改前P0_3有输出

修改后P1_5无输出