初级会员

- 积分
- 160
- 金钱
- 160
- 注册时间
- 2014-11-7
- 在线时间
- 25 小时
|
10金钱
本帖最后由 望卿舒眉 于 2021-5-18 16:56 编辑
如题,我需要实现上电时波特率9600,然后改为57600。uart1_config(57600); uart1_send_buff(table1,3);
执行什么程序后,发现一直在 while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET) 死循环的
需要怎么改
void uart1_config(uint32_t baud)
{
USART_InitTypeDef USART_InitStructure;
USART_Cmd(USART1, DISABLE);
USART_InitStructure.USART_BaudRate =baud;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
USART_Cmd(USART1, ENABLE);
}
|
|