| 
 
| 有大神帮忙看下程序有问题吗,脚位是PA09 PA10 //串口引脚配置
 static void Uart_PortInit(void)
 {
 stc_gpio_cfg_t uartGpioCfg;
 
 DDL_ZERO_STRUCT(uartGpioCfg);
 
 Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE); //使能GPIO模块时钟
 
 ///<TX
 uartGpioCfg.enDir = GpioDirOut;
 Gpio_Init(MAINTX_PORT, MAINTX_PIN, &uartGpioCfg);
 Gpio_SetAfMode(MAINTX_PORT, MAINTX_PIN, GpioAf1);          //配置PA09 端口为URART0_TX
 
 ///<RX
 uartGpioCfg.enDir = GpioDirIn;
 Gpio_Init(MAINRX_PORT, MAINRX_PIN, &uartGpioCfg);
 Gpio_SetAfMode(MAINRX_PORT, MAINRX_PIN, GpioAf1);          //配置PA10 端口为URART0_RX
 }
 
 //串口配置
 static void Uart_CfgInit(void)
 {
 stc_uart_cfg_t stcCfg;
 stc_uart_multimode_t stcMulti;
 stc_uart_baud_t stcBaud;
 
 DDL_ZERO_STRUCT(stcCfg);
 DDL_ZERO_STRUCT(stcMulti);
 DDL_ZERO_STRUCT(stcBaud);
 
 ///< 开启外设时钟
 Sysctrl_SetPeripheralGate(SysctrlPeripheralUart0,TRUE);///<使能uart0模块时钟
 
 ///<UART Init
 stcCfg.enRunMode        = UartMskMode3;          ///<模式3
 stcCfg.enStopBit        = UartMsk1bit;           ///<1bit停止位
 stcCfg.enMmdorCk        = UartMskEven;           ///<偶检验
 stcCfg.stcBaud.u32Baud  = 9600;                  ///<波特率9600
 stcCfg.stcBaud.enClkDiv = UartMsk8Or16Div;       ///<通道采样分频配置
 stcCfg.stcBaud.u32Pclk  = Sysctrl_GetPClkFreq(); ///<获得外设时钟(PCLK)频率值
 Uart_Init(M0P_UART0, &stcCfg);                   ///<串口初始化
 
 ///<UART中断使能
 Uart_ClrStatus(M0P_UART0,UartRC);                ///<清接收请求
 Uart_ClrStatus(M0P_UART0,UartTC);                ///<清接收请求
 Uart_EnableIrq(M0P_UART0,UartRxIrq);             ///<使能串口接收中断
 Uart_EnableIrq(M0P_UART0,UartTxIrq);             ///<使能串口接收中断
 //    EnableNvic(UART0_IRQn, IrqLevel3, TRUE);       ///<系统中断使能
 
 }
 
 void UserUartInit(void)
 {
 Uart_PortInit();
 
 Uart_CfgInit();
 
 //Uart_SendDataIt(M0P_UART0, 0x55); //启动UART1发送第一个字节
 }
 | 
 |