8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
STC8x_UART.h 文件参考
#include "ELL_CORE.h"
#include "STC8Ax_REG.h"
STC8x_UART.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  UART_InitType
 串口初始化结构体句柄,初始化时请定义该句柄,并用其地址来传参。 更多...
 

宏定义

#define PER_LIB_MCU_MUODEL   STC8Ax
 如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax 更多...
 
#define PER_LIB_UART_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_UART_INIT_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_UART_NVIC_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define PER_LIB_UART_WORK_CTRL   1
 如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1" 更多...
 
#define UART1_GET_RX_FLAG()   (SCON & 0x01)
 串口1获取接收标志位宏函数。 更多...
 
#define UART2_GET_RX_FLAG()   (S2CON & 0x01)
 串口2获取接收标志位宏函数。 更多...
 
#define UART3_GET_RX_FLAG()   (S3CON & 0x01)
 串口3获取接收标志位宏函数。 更多...
 
#define UART4_GET_RX_FLAG()   (S4CON & 0x01)
 串口4获取接收标志位宏函数。 更多...
 
#define UART1_CLEAR_RX_FLAG()   do{SCON &= 0xFE;}while(0)
 串口1清除接收标志位宏函数。 更多...
 
#define UART2_CLEAR_RX_FLAG()   do{S2CON &= 0xFE;}while(0)
 串口2清除接收标志位宏函数。 更多...
 
#define UART3_CLEAR_RX_FLAG()   do{S3CON &= 0xFE;}while(0)
 串口3清除接收标志位宏函数。 更多...
 
#define UART4_CLEAR_RX_FLAG()   do{S4CON &= 0xFE;}while(0)
 串口4清除接收标志位宏函数。 更多...
 
#define UART1_GET_TX_FLAG()   (SCON & 0x02)
 串口1获取发送标志位宏函数。 更多...
 
#define UART2_GET_TX_FLAG()   (S2CON & 0x02)
 串口2获取发送标志位宏函数。 更多...
 
#define UART3_GET_TX_FLAG()   (S3CON & 0x02)
 串口3获取发送标志位宏函数。 更多...
 
#define UART4_GET_TX_FLAG()   (S4CON & 0x02)
 串口4获取发送标志位宏函数。 更多...
 
#define UART1_CLEAR_TX_FLAG()   do{SCON &= 0xFD;}while(0)
 串口1清除发送标志位宏函数。 更多...
 
#define UART2_CLEAR_TX_FLAG()   do{S2CON &= 0xFD;}while(0)
 串口2清除发送标志位宏函数。 更多...
 
#define UART3_CLEAR_TX_FLAG()   do{S3CON &= 0xFD;}while(0)
 串口3清除发送标志位宏函数。 更多...
 
#define UART4_CLEAR_TX_FLAG()   do{S4CON &= 0xFD;}while(0)
 串口4清除发送标志位宏函数。 更多...
 
#define NVIC_UART1_CTRL(run)   do{ ES = run; }while(0)
 UART1中断开关控制宏函数。 更多...
 
#define NVIC_UART2_CTRL(run)   do{ IE2 = (IE2 & 0xFE) | (run); }while(0)
 UART2中断开关控制宏函数。 更多...
 
#define NVIC_UART3_CTRL(run)   do{ IE2 = (IE2 & 0xF7) | (run << 3); }while(0)
 UART3中断开关控制宏函数。 更多...
 
#define NVIC_UART4_CTRL(run)   do{ IE2 = (IE2 & 0xEF) | (run << 4); }while(0)
 UART4中断开关控制宏函数。 更多...
 
#define NVIC_UART1_PRI(pri)
 UART1选择中断优先级宏函数。 更多...
 
#define NVIC_UART2_PRI(pri)
 UART2选择中断优先级宏函数。 更多...
 
#define NVIC_UART3_PRI(pri)
 UART3选择中断优先级宏函数。 更多...
 
#define NVIC_UART4_PRI(pri)
 UART4选择中断优先级宏函数。 更多...
 
#define UART1_GET_BUSY_FLAG()   (G_Uart_Busy_Flg & 0x01)
 串口1获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART2_GET_BUSY_FLAG()   (G_Uart_Busy_Flg & 0x02)
 串口2获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART3_GET_BUSY_FLAG()   (G_Uart_Busy_Flg & 0x04)
 串口3获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART4_GET_BUSY_FLAG()   (G_Uart_Busy_Flg & 0x08)
 串口4获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART1_SET_BUSY_FLAG()   do{G_Uart_Busy_Flg |= 0x01;}while(0)
 串口1设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART2_SET_BUSY_FLAG()   do{G_Uart_Busy_Flg |= 0x02;}while(0)
 串口2设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART3_SET_BUSY_FLAG()   do{G_Uart_Busy_Flg |= 0x04;}while(0)
 串口3设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART4_SET_BUSY_FLAG()   do{G_Uart_Busy_Flg |= 0x08;}while(0)
 串口4设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART1_CLEAR_BUSY_FLAG()   do{G_Uart_Busy_Flg &= 0xFE;}while(0)
 串口1设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART2_CLEAR_BUSY_FLAG()   do{G_Uart_Busy_Flg &= 0xFD;}while(0)
 串口2设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART3_CLEAR_BUSY_FLAG()   do{G_Uart_Busy_Flg &= 0xFB;}while(0)
 串口3设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART4_CLEAR_BUSY_FLAG()   do{G_Uart_Busy_Flg &= 0xF7;}while(0)
 串口4设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。 更多...
 
#define UART1_RECEIVE_BYTE(byte)   do{byte = SBUF;}while(0)
 串口1接收一个字节宏函数。 更多...
 
#define UART2_RECEIVE_BYTE(byte)   do{byte = S2BUF;}while(0)
 串口2接收一个字节宏函数。 更多...
 
#define UART3_RECEIVE_BYTE(byte)   do{byte = S3BUF;}while(0)
 串口3接收一个字节宏函数。 更多...
 
#define UART4_RECEIVE_BYTE(byte)   do{byte = S4BUF;}while(0)
 串口4接收一个字节宏函数。 更多...
 

枚举

enum  UARTMode_Type { UART_SyncShift = 0x00 , UART_8bit_BRTx = 0x01 , UART_9bit_Fixed_BRTx = 0x02 , UART_9bit_BRTx = 0x03 }
 串口工作模式枚举体。 更多...
 
enum  UART_BRTGen_Type { UART_BRT_TIM1 = 0x00 , UART_BRT_TIM2 = 0x01 , UART_BRT_TIM3 = 0x02 , UART_BRT_TIM4 = 0x03 }
 串口波特率发生器枚举体。 更多...
 
enum  UART_BRTMode_Type { UART_BRT_1T = 0x00 , UART_BRT_12T = 0x01 }
 串口波特率发生器指令周期枚举体。 更多...
 

函数

FSCSTATE UART1_Init (const UART_InitType *uartx)
 串口1初始化函数。 更多...
 
FSCSTATE UART2_Init (const UART_InitType *uartx)
 串口2初始化函数。 更多...
 
FSCSTATE UART3_Init (const UART_InitType *uartx)
 串口3初始化函数。 更多...
 
FSCSTATE UART4_Init (const UART_InitType *uartx)
 串口4初始化函数。 更多...
 
FSCSTATE NVIC_UART1_Init (NVICPri_Type pri, BOOL run)
 串口1中断初始化函数。 更多...
 
FSCSTATE NVIC_UART2_Init (NVICPri_Type pri, BOOL run)
 串口2中断初始化函数。 更多...
 
FSCSTATE NVIC_UART3_Init (BOOL run)
 串口3中断初始化函数。 更多...
 
FSCSTATE NVIC_UART4_Init (BOOL run)
 串口4中断初始化函数。 更多...
 
FSCSTATE GPIO_UART1_SWPort (GPIOSWPort_Type port)
 串口1切换复用IO函数。 更多...
 
FSCSTATE GPIO_UART2_SWPort (GPIOSWPort_Type port)
 串口2切换复用IO函数。 更多...
 
FSCSTATE GPIO_UART3_SWPort (GPIOSWPort_Type port)
 串口3切换复用IO函数。 更多...
 
FSCSTATE GPIO_UART4_SWPort (GPIOSWPort_Type port)
 串口4切换复用IO函数。 更多...
 
void UART1_Isr_Send_Byte (uint8_t dat)
 串口1发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART2_Isr_Send_Byte (uint8_t dat)
 串口2发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART3_Isr_Send_Byte (uint8_t dat)
 串口3发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART4_Isr_Send_Byte (uint8_t dat)
 串口4发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART1_Isr_Send_String (const uint8_t *str)
 串口1发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART2_Isr_Send_String (const uint8_t *str)
 串口2发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART3_Isr_Send_String (const uint8_t *str)
 串口3发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART4_Isr_Send_String (const uint8_t *str)
 串口4发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART1_Isr_Send_Array (const uint8_t *str, uint16_t len)
 串口1发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART2_Isr_Send_Array (const uint8_t *str, uint16_t len)
 串口2发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART3_Isr_Send_Array (const uint8_t *str, uint16_t len)
 串口3发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 
void UART4_Isr_Send_Array (const uint8_t *str, uint16_t len)
 串口4发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。 更多...
 

变量

uint8_t G_Uart_Busy_Flg
 串口忙标志位,这是ELL库自定义从防止多串口冲突的变量。 更多...
 

宏定义说明

◆ NVIC_UART1_CTRL

#define NVIC_UART1_CTRL (   run)    do{ ES = run; }while(0)

UART1中断开关控制宏函数。

UART1 interrupt switch control macro function.

参数
[in]run使能控制位。Enable control bit.

◆ NVIC_UART1_PRI

#define NVIC_UART1_PRI (   pri)
值:
do{ \
IPH = (IPH & 0xEF) | ((pri & 0x02) << 3); \
IP = (IP & 0xEF) | ((pri & 0x01) << 4); \
}while(0)
sfr IPH
Definition: STC15x_REG.h:212
sfr IP
Definition: STC15x_REG.h:210

UART1选择中断优先级宏函数。

UART1 select interrupt pri macro function.

参数
[in]pri中断优先级。 pri of interrupt.

◆ NVIC_UART2_CTRL

#define NVIC_UART2_CTRL (   run)    do{ IE2 = (IE2 & 0xFE) | (run); }while(0)

UART2中断开关控制宏函数。

UART2 interrupt switch control macro function.

参数
[in]run使能控制位。Enable control bit.

◆ NVIC_UART2_PRI

#define NVIC_UART2_PRI (   pri)
值:
do{ \
IP2H = (IP2H & 0xFE) | ((pri & 0x02) >> 1); \
IP2 = (IP2 & 0xFE) | (pri & 0x01); \
}while(0)
sfr IP2H
Definition: STC15x_REG.h:213
sfr IP2
Definition: STC15x_REG.h:211

UART2选择中断优先级宏函数。

UART2 select interrupt pri macro function.

参数
[in]pri中断优先级。 pri of interrupt.

◆ NVIC_UART3_CTRL

#define NVIC_UART3_CTRL (   run)    do{ IE2 = (IE2 & 0xF7) | (run << 3); }while(0)

UART3中断开关控制宏函数。

UART3 interrupt switch control macro function.

参数
[in]run使能控制位。Enable control bit.

◆ NVIC_UART3_PRI

#define NVIC_UART3_PRI (   pri)
值:
do{ \
IP3H = (IP3H & 0xFE) | ((pri & 0x02) >> 1); \
IP3 = (IP3 & 0xFE) | (pri & 0x01); \
}while(0)
sfr IP3H
Definition: STC8Cx_REG.h:216
sfr IP3
Definition: STC8Cx_REG.h:215

UART3选择中断优先级宏函数。

UART3 select interrupt pri macro function.

参数
[in]pri中断优先级。 pri of interrupt.

◆ NVIC_UART4_CTRL

#define NVIC_UART4_CTRL (   run)    do{ IE2 = (IE2 & 0xEF) | (run << 4); }while(0)

UART4中断开关控制宏函数。

UART4 interrupt switch control macro function.

参数
[in]run使能控制位。Enable control bit.

◆ NVIC_UART4_PRI

#define NVIC_UART4_PRI (   pri)
值:
do{ \
IP3H = (IP3H & 0xFD) | (pri & 0x02); \
IP3 = (IP3 & 0xFD) | (pri & 0x01) << 1; \
}while(0)

UART4选择中断优先级宏函数。

UART4 select interrupt pri macro function.

参数
[in]pri中断优先级。 pri of interrupt.

◆ PER_LIB_MCU_MUODEL

#define PER_LIB_MCU_MUODEL   STC8Ax

如果没有定义这个宏,默认为STC8Ax。 If the mirco is undefined,select to STC8Ax

◆ PER_LIB_UART_CTRL

#define PER_LIB_UART_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_UART_INIT_CTRL

#define PER_LIB_UART_INIT_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_UART_NVIC_CTRL

#define PER_LIB_UART_NVIC_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ PER_LIB_UART_WORK_CTRL

#define PER_LIB_UART_WORK_CTRL   1

如果没有定义这个宏,默认为1。 If the mirco is undefined,select to "1"

◆ UART1_CLEAR_BUSY_FLAG

#define UART1_CLEAR_BUSY_FLAG ( )    do{G_Uart_Busy_Flg &= 0xFE;}while(0)

串口1设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 1 clears busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART1_CLEAR_RX_FLAG

#define UART1_CLEAR_RX_FLAG ( )    do{SCON &= 0xFE;}while(0)

串口1清除接收标志位宏函数。

Serial port 1 clears received flag macro function.

◆ UART1_CLEAR_TX_FLAG

#define UART1_CLEAR_TX_FLAG ( )    do{SCON &= 0xFD;}while(0)

串口1清除发送标志位宏函数。

Serial port 1 clears the sending flag bit macro function.

◆ UART1_GET_BUSY_FLAG

#define UART1_GET_BUSY_FLAG ( )    (G_Uart_Busy_Flg & 0x01)

串口1获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 1 gets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

返回
[bit] 忙标志位。Busy flag.

◆ UART1_GET_RX_FLAG

#define UART1_GET_RX_FLAG ( )    (SCON & 0x01)

串口1获取接收标志位宏函数。

Serial port 1 gets received flag macro function.

◆ UART1_GET_TX_FLAG

#define UART1_GET_TX_FLAG ( )    (SCON & 0x02)

串口1获取发送标志位宏函数。

Serial port 1 gets sending flag macro function.

◆ UART1_RECEIVE_BYTE

#define UART1_RECEIVE_BYTE (   byte)    do{byte = SBUF;}while(0)

串口1接收一个字节宏函数。

Serial port 1 receives a byte function。

参数
[in]byte字节。

◆ UART1_SET_BUSY_FLAG

#define UART1_SET_BUSY_FLAG ( )    do{G_Uart_Busy_Flg |= 0x01;}while(0)

串口1设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 1 sets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART2_CLEAR_BUSY_FLAG

#define UART2_CLEAR_BUSY_FLAG ( )    do{G_Uart_Busy_Flg &= 0xFD;}while(0)

串口2设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 2 clears busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART2_CLEAR_RX_FLAG

#define UART2_CLEAR_RX_FLAG ( )    do{S2CON &= 0xFE;}while(0)

串口2清除接收标志位宏函数。

Serial port 2 clears received flag macro function.

◆ UART2_CLEAR_TX_FLAG

#define UART2_CLEAR_TX_FLAG ( )    do{S2CON &= 0xFD;}while(0)

串口2清除发送标志位宏函数。

Serial port 2 clears the sending flag bit macro function.

◆ UART2_GET_BUSY_FLAG

#define UART2_GET_BUSY_FLAG ( )    (G_Uart_Busy_Flg & 0x02)

串口2获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 2 gets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

返回
[bit] 忙标志位。Busy flag.

◆ UART2_GET_RX_FLAG

#define UART2_GET_RX_FLAG ( )    (S2CON & 0x01)

串口2获取接收标志位宏函数。

Serial port 2 gets received flag macro function.

◆ UART2_GET_TX_FLAG

#define UART2_GET_TX_FLAG ( )    (S2CON & 0x02)

串口2获取发送标志位宏函数。

Serial port 2 gets sending flag macro function.

◆ UART2_RECEIVE_BYTE

#define UART2_RECEIVE_BYTE (   byte)    do{byte = S2BUF;}while(0)

串口2接收一个字节宏函数。

Serial port 2 receives a byte function。

参数
[in]byte字节。

◆ UART2_SET_BUSY_FLAG

#define UART2_SET_BUSY_FLAG ( )    do{G_Uart_Busy_Flg |= 0x02;}while(0)

串口2设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 2 sets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART3_CLEAR_BUSY_FLAG

#define UART3_CLEAR_BUSY_FLAG ( )    do{G_Uart_Busy_Flg &= 0xFB;}while(0)

串口3设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 3 clears busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART3_CLEAR_RX_FLAG

#define UART3_CLEAR_RX_FLAG ( )    do{S3CON &= 0xFE;}while(0)

串口3清除接收标志位宏函数。

Serial port 3 clears received flag macro function.

◆ UART3_CLEAR_TX_FLAG

#define UART3_CLEAR_TX_FLAG ( )    do{S3CON &= 0xFD;}while(0)

串口3清除发送标志位宏函数。

Serial port 3 clears the sending flag bit macro function.

◆ UART3_GET_BUSY_FLAG

#define UART3_GET_BUSY_FLAG ( )    (G_Uart_Busy_Flg & 0x04)

串口3获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 3 gets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

返回
[bit] 忙标志位。Busy flag.

◆ UART3_GET_RX_FLAG

#define UART3_GET_RX_FLAG ( )    (S3CON & 0x01)

串口3获取接收标志位宏函数。

Serial port 3 gets received flag macro function.

◆ UART3_GET_TX_FLAG

#define UART3_GET_TX_FLAG ( )    (S3CON & 0x02)

串口3获取发送标志位宏函数。

Serial port 3 gets sending flag macro function.

◆ UART3_RECEIVE_BYTE

#define UART3_RECEIVE_BYTE (   byte)    do{byte = S3BUF;}while(0)

串口3接收一个字节宏函数。

Serial port 3 receives a byte function。

参数
[in]byte字节。

◆ UART3_SET_BUSY_FLAG

#define UART3_SET_BUSY_FLAG ( )    do{G_Uart_Busy_Flg |= 0x04;}while(0)

串口3设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 3 sets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART4_CLEAR_BUSY_FLAG

#define UART4_CLEAR_BUSY_FLAG ( )    do{G_Uart_Busy_Flg &= 0xF7;}while(0)

串口4设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 4 clears busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

◆ UART4_CLEAR_RX_FLAG

#define UART4_CLEAR_RX_FLAG ( )    do{S4CON &= 0xFE;}while(0)

串口4清除接收标志位宏函数。

Serial port 4 clears received flag macro function.

◆ UART4_CLEAR_TX_FLAG

#define UART4_CLEAR_TX_FLAG ( )    do{S4CON &= 0xFD;}while(0)

串口4清除发送标志位宏函数。

Serial port 4 clears the sending flag bit macro function.

◆ UART4_GET_BUSY_FLAG

#define UART4_GET_BUSY_FLAG ( )    (G_Uart_Busy_Flg & 0x08)

串口4获取忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 4 gets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

返回
[bit] 忙标志位。Busy flag.

◆ UART4_GET_RX_FLAG

#define UART4_GET_RX_FLAG ( )    (S4CON & 0x01)

串口4获取接收标志位宏函数。

Serial port 4 gets received flag macro function.

◆ UART4_GET_TX_FLAG

#define UART4_GET_TX_FLAG ( )    (S4CON & 0x02)

串口4获取发送标志位宏函数。

Serial port 4 gets sending flag macro function.

◆ UART4_RECEIVE_BYTE

#define UART4_RECEIVE_BYTE (   byte)    do{byte = S4BUF;}while(0)

串口4接收一个字节宏函数。

Serial port 4 receives a byte function。

参数
[in]byte字节。

◆ UART4_SET_BUSY_FLAG

#define UART4_SET_BUSY_FLAG ( )    do{G_Uart_Busy_Flg |= 0x08;}while(0)

串口4设置忙标志位宏函数, 这是ELL自定义的标志位变量,并非硬件寄存器。

Serial port 4 sets busy flag macro function, This is a self-defined flag bit variable of ELL, not a hardware register.

枚举类型说明

◆ UART_BRTGen_Type

串口波特率发生器枚举体。

UART Baud rate generatorenum.

枚举值
UART_BRT_TIM1 

定时器1做波特率发生器。Timer 1 as baud rate generator.

UART_BRT_TIM2 

定时器2做波特率发生器。Timer 2 as baud rate generator.

UART_BRT_TIM3 

定时器3做波特率发生器。Timer 3 as baud rate generator.

UART_BRT_TIM4 

定时器4做波特率发生器。Timer 4 as baud rate generator.

◆ UART_BRTMode_Type

串口波特率发生器指令周期枚举体。

UART Baud rate Clock mode enum.

枚举值
UART_BRT_1T 

1T指令周期。 CPU clock without frequency division.

UART_BRT_12T 

12T指令周期。CPU clock 12 frequency division.

◆ UARTMode_Type

串口工作模式枚举体。

UART working mode enum.

枚举值
UART_SyncShift 

同步移位串行工作模式。Synchronous shift serial.

UART_8bit_BRTx 

8位可变波特率工作模式。8-bit data, variable baud rate.

UART_9bit_Fixed_BRTx 

9位固定波特率工作模式。9-bit data, fixed baud rate.

UART_9bit_BRTx 

9位可变波特率工作模式。9-bit data, variable baud rate.

函数说明

◆ GPIO_UART1_SWPort()

FSCSTATE GPIO_UART1_SWPort ( GPIOSWPort_Type  port)

串口1切换复用IO函数。

UART1 switch out port control function.

参数
[in]port复用IO枚举体。IO switch enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ GPIO_UART2_SWPort()

FSCSTATE GPIO_UART2_SWPort ( GPIOSWPort_Type  port)

串口2切换复用IO函数。

UART2 switch out port control function.

参数
[in]port复用IO枚举体。IO switch enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ GPIO_UART3_SWPort()

FSCSTATE GPIO_UART3_SWPort ( GPIOSWPort_Type  port)

串口3切换复用IO函数。

UART3 switch out port control function.

参数
[in]port复用IO枚举体。IO switch enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ GPIO_UART4_SWPort()

FSCSTATE GPIO_UART4_SWPort ( GPIOSWPort_Type  port)

串口4切换复用IO函数。

UART4 switch out port control function.

参数
[in]port复用IO枚举体。IO switch enumerator.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ NVIC_UART1_Init()

FSCSTATE NVIC_UART1_Init ( NVICPri_Type  pri,
BOOL  run 
)

串口1中断初始化函数。

UART1 NVIC function.

参数
[in]pri中断优先级。interrupt pri.
[in]run使能控制位。enable control.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ NVIC_UART2_Init()

FSCSTATE NVIC_UART2_Init ( NVICPri_Type  pri,
BOOL  run 
)

串口2中断初始化函数。

UART2 NVIC function.

参数
[in]pri中断优先级。interrupt pri.
[in]run使能控制位。enable control.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ NVIC_UART3_Init()

FSCSTATE NVIC_UART3_Init ( BOOL  run)

串口3中断初始化函数。

UART3 NVIC function.

参数
[in]run使能控制位。enable control.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ NVIC_UART4_Init()

FSCSTATE NVIC_UART4_Init ( BOOL  run)

串口4中断初始化函数。

UART4 NVIC function.

参数
[in]run使能控制位。enable control.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ UART1_Init()

FSCSTATE UART1_Init ( const UART_InitType uartx)

串口1初始化函数。

UART1 peripheral init function.

参数
[in]uartx串口初始化结构体句柄,初始化时请定义该句柄,并将其地址传参。 The uart initializes the structure handle. When initializing, please define the handle and pass its address to the parameter.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ UART1_Isr_Send_Array()

void UART1_Isr_Send_Array ( const uint8_t str,
uint16_t  len 
)

串口1发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 1 sends a arry function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]arry要发送的数组地址。The address of the array to be sent.
[in]len要发送的数组长度。The length of the array to be sent.
返回
None.

◆ UART1_Isr_Send_Byte()

void UART1_Isr_Send_Byte ( uint8_t  dat)

串口1发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 1 sends a byte function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]dat要发送的字节数据。The byte data to be sent.
返回
None.

◆ UART1_Isr_Send_String()

void UART1_Isr_Send_String ( const uint8_t str)

串口1发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 1 sends a string function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]str要发送的字符串地址。String address to be sent.
返回
None.

◆ UART2_Init()

FSCSTATE UART2_Init ( const UART_InitType uartx)

串口2初始化函数。

UART2 peripheral init function.

参数
[in]uartx串口初始化结构体句柄,初始化时请定义该句柄,并将其地址传参。 The uart initializes the structure handle. When initializing, please define the handle and pass its address to the parameter.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ UART2_Isr_Send_Array()

void UART2_Isr_Send_Array ( const uint8_t str,
uint16_t  len 
)

串口2发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 2 sends a arry function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]arry要发送的数组地址。The address of the array to be sent.
[in]len要发送的数组长度。The length of the array to be sent.
返回
None.

◆ UART2_Isr_Send_Byte()

void UART2_Isr_Send_Byte ( uint8_t  dat)

串口2发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 2 sends a byte function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]dat要发送的字节数据。The byte data to be sent.
返回
None.

◆ UART2_Isr_Send_String()

void UART2_Isr_Send_String ( const uint8_t str)

串口2发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 2 sends a string function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]str要发送的字符串地址。String address to be sent.
返回
None.

◆ UART3_Init()

FSCSTATE UART3_Init ( const UART_InitType uartx)

串口3初始化函数。

UART3 peripheral init function.

参数
[in]uartx串口初始化结构体句柄,初始化时请定义该句柄,并将其地址传参。 The uart initializes the structure handle. When initializing, please define the handle and pass its address to the parameter.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ UART3_Isr_Send_Array()

void UART3_Isr_Send_Array ( const uint8_t str,
uint16_t  len 
)

串口3发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 3 sends a arry function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]arry要发送的数组地址。The address of the array to be sent.
[in]len要发送的数组长度。The length of the array to be sent.
返回
None.

◆ UART3_Isr_Send_Byte()

void UART3_Isr_Send_Byte ( uint8_t  dat)

串口3发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 3 sends a byte function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]dat要发送的字节数据。The byte data to be sent.
返回
None.

◆ UART3_Isr_Send_String()

void UART3_Isr_Send_String ( const uint8_t str)

串口3发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 3 sends a string function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]str要发送的字符串地址。String address to be sent.
返回
None.

◆ UART4_Init()

FSCSTATE UART4_Init ( const UART_InitType uartx)

串口4初始化函数。

UART4 peripheral init function.

参数
[in]uartx串口初始化结构体句柄,初始化时请定义该句柄,并将其地址传参。 The uart initializes the structure handle. When initializing, please define the handle and pass its address to the parameter.
返回
FSC_SUCCESS 返回成功。Return to success.
FSC_FAIL 返回失败。Return to fail.

◆ UART4_Isr_Send_Array()

void UART4_Isr_Send_Array ( const uint8_t str,
uint16_t  len 
)

串口4发送一个数组函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 4 sends a arry function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]arry要发送的数组地址。The address of the array to be sent.
[in]len要发送的数组长度。The length of the array to be sent.
返回
None.

◆ UART4_Isr_Send_Byte()

void UART4_Isr_Send_Byte ( uint8_t  dat)

串口4发送一个字节函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 4 sends a byte function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]dat要发送的字节数据。The byte data to be sent.
返回
None.

◆ UART4_Isr_Send_String()

void UART4_Isr_Send_String ( const uint8_t str)

串口4发送一个字符串函数, 需要开启中断,并在中断服务函数中清除发送标志位。

Serial port 4 sends a string function, Need to turn on the interrupt and clear the sending flag, in the interrupt service function.

参数
[in]str要发送的字符串地址。String address to be sent.
返回
None.

变量说明

◆ G_Uart_Busy_Flg

uint8_t G_Uart_Busy_Flg
extern

串口忙标志位,这是ELL库自定义从防止多串口冲突的变量。

Serial port busy flag, this is a variable customized by the ELL library to prevent multiple serial port conflicts.