uart串口协议

 

uart串口协议

 

/* USART Word Length ---------------------------------------------------------*/

    USART_WordLength_8b

    USART_WordLength_9b

 

/* USART Stop Bits -----------------------------------------------------------*/

    USART_StopBits_1

    USART_StopBits_0_5

    USART_StopBits_2

    USART_StopBits_1_5

 

/* USART Parity --------------------------------------------------------------*/

USART_Parity_No

USART_Parity_Even

USART_Parity_Odd

 

示例:(stm32)

 

基本配置:

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;

 

更改设置,用逻辑分析仪观察不同配置下波形。

(1)总长8位,8位数据位,无校验

 

(2)总长9位,8位数据位,偶校验

(3)总长8位,7位数据位偶校验

 

posted @ 2016-03-02 15:07  oucaijun  阅读(719)  评论(0编辑  收藏  举报
下载TeamViewer完整版 下载TeamViewer