求大神帮忙注释一下这段stm32 usart语句
USART_InitStructure.USART_BaudRate=115200;USART_InitStructure.USART_WordLength=USART_...
USART_InitStructure.USART_BaudRate= 115200;
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);
}
int fputc(int ch, FILE *f)
{
USART_SendData(USART1,(u8)ch);
while(USART_GetFlagStatus(USART1,USART_FLAG_TC) == RESET);
returnch;
} 展开
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);
}
int fputc(int ch, FILE *f)
{
USART_SendData(USART1,(u8)ch);
while(USART_GetFlagStatus(USART1,USART_FLAG_TC) == RESET);
returnch;
} 展开
2个回答
展开全部
// 配置串口的工作参数
// 配置波特率为115200
USART_InitStructure.USART_BaudRate = 115200;
// 配置 针数据字长为8位
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
// 配置停止位为1位
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);
// 使能串口1
USART_Cmd(USART1, ENABLE);
// 配置波特率为115200
USART_InitStructure.USART_BaudRate = 115200;
// 配置 针数据字长为8位
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
// 配置停止位为1位
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);
// 使能串口1
USART_Cmd(USART1, ENABLE);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |