void PORT_Init (void)
{
char SFRPAGE_SAVE = SFRPAGE;
SFRPAGE = CONFIG_PAGE;
XBR0 = 0x04; // Enable UART0
XBR1 = 0x00;
XBR2 = 0x40; // Enable crossbar and weak pull-up
P0MDOUT |= 0x01; // Set TX0 pin to push-pull
P1MDOUT |= 0x40; // Set P1.6(LED) to push-pull
P2MDOUT |= 0xff;
P3MDOUT |= 0xff;
// P2 =0XFF;
// P3 =0XFF;
SFRPAGE = SFRPAGE_SAVE;
}
这是IO设置子程序 串口倒是工作正常
|