uart.h

来自「avr单片机mega128 的串口通讯的完整程序」· C头文件 代码 · 共 49 行

H
49
字号
#ifndef	__UART__H
#define	__UART__H

//初始化RS485通讯的流控制引脚
#define  RS485_RD0_DDR    DDRE
#define  RS485_RD0_PORT   PORTE
#define  RS485_RD0_BIT    (1<<PE2)

#define  RS485_RD0_L    RS485_RD0_PORT |= RS485_RD0_BIT
#define  RS485_RD0_H      RS485_RD0_PORT &= ~RS485_RD0_BIT

//-----------------------------------------------------------
//串口0初始化子程序
//-----------------------------------------------------------
void Uart0_Init(void);

//-----------------------------------------------------------
//串口0接收字节子程序
//-----------------------------------------------------------
unsigned char Getchar0(void);

//-----------------------------------------------------------
//串口0发送字节子程序
//-----------------------------------------------------------
void Putchar0(unsigned char c);

//-----------------------------------------------------------
//串口0发送字符串子程序
//-----------------------------------------------------------
void Putstr0(char *s);

//-----------------------------------------------------------
//串口0发送字符串子程序(带有换行符)
//-----------------------------------------------------------
void Puts0(char *s);

//-----------------------------------------------------------
//数组转换成可发送的字符串
//-----------------------------------------------------------
char *buffer2str(char *hhh);
//-----------------------------------------------------------
//数字转换成可发送的字符串
//-----------------------------------------------------------
char *long2str(unsigned long hh);

//-----------------------------------------------------------

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?