为什么华大HC32L130单片机 如何不支持波特率115200
/**********************************************************************
* Function: AppUser_UART2_Config
* Description: ´®¿ÚÐÅÏ¢
* Input: void
* Output:
* Return: void
* Others:
* Modify Date: Version: Author: Modification:
* -----------------------------------------------
* 2017-05-31 V1.0 Hu Weiping
**********************************************************************/
void AppUser_UART0_Config(uint16_t BaudRate)
{
uint16_t u16Scnt = 0;
stc_uart_config_t stcConfig;
stc_uart_irq_cb_t stcUartIrqCb;
stc_uart_multimode_t stcMulti;
stc_uart_baud_t stcBaud;
en_uart_mmdorck_t enTb8;
DDL_ZERO_STRUCT(stcConfig);
DDL_ZERO_STRUCT(stcUartIrqCb);
DDL_ZERO_STRUCT(stcMulti);
DDL_ZERO_STRUCT(stcBaud);
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE);
Sysctrl_SetPeripheralGate(SysctrlPeripheralDma,TRUE);
Sysctrl_SetPeripheralGate(SysctrlPeripheralUart0,TRUE);
AppUser_Uart0_PortInit(); //ÅäÖö˿Ú
stcUartIrqCb.pfnRxIrqCb = Rx_UART0_IntCallback;
stcUartIrqCb.pfnTxIrqCb = NULL;
stcUartIrqCb.pfnRxFEIrqCb = UART0_ErrIntCallback;
stcUartIrqCb.pfnPEIrqCb = UART0_PErrIntCallBack;
stcUartIrqCb.pfnCtsIrqCb = UART0_CtsIntCallBack;
stcConfig.pstcIrqCb = &stcUartIrqCb;
stcConfig.bTouchNvic = TRUE;
stcConfig.enRunMode = UartMode1;//??3
stcConfig.enStopBit = Uart1bit;
stcMulti.enMulti_mode = UartNormal;//??????
enTb8 = UartEven;//???
Uart_SetMMDOrCk(UARTCH0,enTb8);
stcConfig.pstcMultiMode = &stcMulti;
Uart_Init(UARTCH0, &stcConfig); //ÅäÖö˿Ú
Uart_SetClkDiv(UARTCH0,Uart8Or16Div);
stcBaud.u32Pclk = Sysctrl_GetPClkFreq();
stcBaud.enRunMode = UartMode1;
stcBaud.u32Baud = BaudRate;
u16Scnt = Uart_CalScnt(UARTCH0,&stcBaud);
Uart_SetBaud(UARTCH0,u16Scnt);
Uart_EnableIrq(UARTCH0,UartRxIrq);
Uart_ClrStatus(UARTCH0,UartRC);
Uart_EnableFunc(UARTCH0,UartRx);
Uart_DisableIrq(UARTCH0,UartTxIrq);
g_IR_RXCunt = 0;
} |