⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart1.h

📁 MEGA128 串口驱动程序 两个串口都有,包括H文件和C文件
💻 H
字号:
/**********************************************************************
* System Name		DOOR
* Header Name		uart1.h
* Version	Date		Editor		Modification
* 1.0		2007/05/10	周斌		做成
**********************************************************************/



#include "global.h"

//uart波特率
#ifndef _BAUD_
#define _BAUD_

	#define BAUD_300 	1
	#define BAUD_600 	2
	#define BAUD_900 	3
	#define BAUD_1200 	4
	#define BAUD_2400 	5
	#define BAUD_4800 	6
	#define BAUD_9600 	7
	#define BAUD_19200 	8
	#define BAUD_28800 	9
	#define BAUD_38400 	10
	#define BAUD_57600 	11
	#define BAUD_76800 	12
	#define BAUD_115200 13
	#define BAUD_128000 14
	#define BAUD_256000 15

#endif



/**********************************************************************
* Function Name		uart1_init
* Function Desc		串口1初始化
* Return Value		无
* Parameter         
			t_ubbr:波特率配置选择
* Version	Date		Editor		Modification
* 1.0		2007/05/09	周斌		做成
**********************************************************************/
void uart1_init(UCHAR t_baud);




/**********************************************************************
* Function Name		uart1_put_byte
* Function Desc		通过串口1发送一个字节
* Return Value		无
* Parameter         
			t_char	要发送的字符
* Version	Date		Editor		Modification
* 1.0		2007/05/09	周斌		做成
**********************************************************************/
void uart1_put_byte(char t_char);





/**********************************************************************
* Function Name		uart1_put_string
* Function Desc		通过串口1发送一个字符串
* Return Value		无
* Parameter         
*				*p_str	字符串首指针
* Version	Date		Editor		Modification
* 1.0		2007/05/09	周斌		做成
**********************************************************************/
void uart1_put_string(char * p_str);



/**********************************************************************
* Function Name		uart1_get_byte
* Function Desc		从串口1的缓存中取一个字节
* Return Value		
*		SUCESS:	取字节成功
*		FAIL:	取字节失败
* Parameter         
			*t_char	取字节地址
* Version	Date		Editor		Modification
* 1.0		2007/05/10	周斌		做成
**********************************************************************/
UCHAR uart1_get_byte(char * t_char);











/***nction Name		uart1_get_bytes
* Function Desc		从串口1的缓存中取len个字节
* Return Value		
*		SUCESS:	取字节成功
*		FAIL:	取字节失败
* Parameter         
			*t_char	取字节地址     len  数据长度
* Version	Date		Editor		Modification
* 1.0		2007/05/10   史玮		做成
**********************************************************************/
UCHAR uart1_get_bytes(UCHAR * t_char,UINT len);



/**********************************************************************
* Function Name		uart1_put_bytes
* Function Desc		通过串口0发送len个字节
* Return Value		无
* Parameter         
			pBytes	要发送的数据的首地址   
			len     数据长度
* Version	Date		Editor		Modification
* 1.0		2007/05/09	史玮		做成
**********************************************************************/
void uart1_put_bytes(UCHAR * pBytes,UCHAR len);



/**********************************************************************
* Function Name		uart1_get_buffer_len()
* Function Desc		获取缓冲区数据长度
* Return Value		缓冲区数据长度
* Parameter         
			
* Version	Date		Editor		Modification
* 1.0		2007/05/09	史玮		做成
**********************************************************************/
UINT uart1_get_buffer_len();

/**********************************************************************
* Function Name		uart1_clear_buffer()
* Function Desc		清缓冲区
* Return Value		
* Parameter         
			
* Version	Date		Editor		Modification
* 1.0		2007/05/09	史玮		做成
**********************************************************************/
void uart1_clear_buffer();

⌨️ 快捷键说明

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