8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_UART.c 文件参考
#include "STC8x_UART.h"
STC8x_UART.c 的引用(Include)关系图:

宏定义

#define UART1_MODE_CFG(mode)   do{SM0 = mode >> 1, SM1 = mode;}while(0)
 串口1工作模式选择宏函数,仅限本文件内调用。 更多...
 
#define UART2_MODE_CFG(mode)   do{S2CON = (S2CON & 0x3F)|((mode & 0x02) << 6);}while(0)
 串口2工作模式选择宏函数,仅限本文件内调用。 更多...
 
#define UART3_MODE_CFG(mode)   do{S3CON = (S3CON & 0x3F)|((mode & 0x02) << 6);}while(0)
 串口3工作模式选择宏函数,仅限本文件内调用。 更多...
 
#define UART4_MODE_CFG(mode)   do{S4CON = (S4CON & 0x3F)|((mode & 0x02) << 6);}while(0)
 串口4工作模式选择宏函数,仅限本文件内调用。 更多...
 
#define UART1_TIMER1_BRTMODE_CFG(brtMode, baudRate)
 串口1用定时器1做波特率发生器计算波特率宏函数,仅限本文件内调用。 更多...
 
#define uartx_TIMER2_BRTMODE_CFG(brtMode, baudRate)
 串口用定时器2做波特率发生器计算波特率宏函数,仅限本文件内调用。 更多...
 
#define UART3_TIMER3_BRTMODE_CFG(brtMode, baudRate)
 串口3用定时器3做波特率发生器计算波特率宏函数,仅限本文件内调用。 更多...
 
#define UART4_TIMER4_BRTMODE_CFG(brtMode, baudRate)
 串口4用定时器4做波特率发生器计算波特率宏函数,仅限本文件内调用。 更多...
 

宏定义说明

◆ UART1_MODE_CFG

#define UART1_MODE_CFG (   mode)    do{SM0 = mode >> 1, SM1 = mode;}while(0)

串口1工作模式选择宏函数,仅限本文件内调用。

Serial Port 1 mode of operation selects macro functions and is only called within this file.

◆ UART1_TIMER1_BRTMODE_CFG

#define UART1_TIMER1_BRTMODE_CFG (   brtMode,
  baudRate 
)
值:
do{ \
AUXR = (AUXR & 0xBF) | ( !brtMode << 6 ); \
T1L = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(AUXR & 0x40)) + 1 ))); \
T1H = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(AUXR & 0x40)) + 1 ))) >> 8; \
}while(0)
sfr AUXR
Definition: STC15x_REG.h:65

串口1用定时器1做波特率发生器计算波特率宏函数,仅限本文件内调用。

Serial port 1 uses timer 1 to do baud rate generator calculation baud rate macro function, which is only called in this file.

参数
[in]brtMode波特率发生器模式。Baud rate generator mode.
[in]baudRate波特率。Baud rate.

◆ UART2_MODE_CFG

#define UART2_MODE_CFG (   mode)    do{S2CON = (S2CON & 0x3F)|((mode & 0x02) << 6);}while(0)

串口2工作模式选择宏函数,仅限本文件内调用。

Serial Port 2 mode of operation selects macro functions and is only called within this file.

◆ UART3_MODE_CFG

#define UART3_MODE_CFG (   mode)    do{S3CON = (S3CON & 0x3F)|((mode & 0x02) << 6);}while(0)

串口3工作模式选择宏函数,仅限本文件内调用。

Serial Port 3 mode of operation selects macro functions and is only called within this file.

◆ UART3_TIMER3_BRTMODE_CFG

#define UART3_TIMER3_BRTMODE_CFG (   brtMode,
  baudRate 
)
值:
do{ \
T4T3M = (T4T3M & 0xFD) | ( !brtMode << 1 ); \
T3L = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(T4T3M & 0x02)) + 1 ))); \
T3H = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(T4T3M & 0x02)) + 1 ))) >> 8; \
}while(0)
sfr T4T3M
Definition: STC15x_REG.h:621

串口3用定时器3做波特率发生器计算波特率宏函数,仅限本文件内调用。

Serial port 3 uses timer 3 to do baud rate generator calculation baud rate macro function, which is only called in this file.

参数
[in]brtMode波特率发生器模式。Baud rate generator mode.
[in]baudRate波特率。Baud rate.

◆ UART4_MODE_CFG

#define UART4_MODE_CFG (   mode)    do{S4CON = (S4CON & 0x3F)|((mode & 0x02) << 6);}while(0)

串口4工作模式选择宏函数,仅限本文件内调用。

Serial Port 4 mode of operation selects macro functions and is only called within this file.

◆ UART4_TIMER4_BRTMODE_CFG

#define UART4_TIMER4_BRTMODE_CFG (   brtMode,
  baudRate 
)
值:
do{ \
T4T3M = (T4T3M & 0xDF) | ( !brtMode << 5 ); \
T4L = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(T4T3M & 0x20)) + 1 ))); \
T4H = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(T4T3M & 0x20)) + 1 ))) >> 8; \
}while(0)

串口4用定时器4做波特率发生器计算波特率宏函数,仅限本文件内调用。

Serial port 4 uses timer 4 to do baud rate generator calculation baud rate macro function, which is only called in this file.

参数
[in]brtMode波特率发生器模式。Baud rate generator mode.
[in]baudRate波特率。Baud rate.

◆ uartx_TIMER2_BRTMODE_CFG

#define uartx_TIMER2_BRTMODE_CFG (   brtMode,
  baudRate 
)
值:
do{ \
AUXR = (AUXR & 0xFB) | ( !brtMode << 2 ); \
T2L = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(AUXR & 0x04)) + 1 ))); \
T2H = (65536UL - sysClk_FRE / (baudRate * 4 * (11 * (!(AUXR & 0x04)) + 1 ))) >> 8; \
}while(0)

串口用定时器2做波特率发生器计算波特率宏函数,仅限本文件内调用。

Serial port uses timer 2 to do baud rate generator calculation baud rate macro function, which is only called in this file.

参数
[in]brtMode波特率发生器模式。Baud rate generator mode.
[in]baudRate波特率。Baud rate.