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

📄 serial.c

📁 与C51相关模块LCD,24CXX,等的源代码程序
💻 C
字号:
/******************************************************
DESIGN FOR RS232 USE
Designer: BH Zhang
Date:2006-1-11
Ver:1.0
Modify Mark:NONE
*******************************************************/
#include <at89x51.h>
#include "serial.h"
//------------------------------------------------------
void InitSerial(void){
	PCON|=SMOD_;	//Double Baudrate
	SCON=0x40;		//Serial Port Work on Mode 1,
					//Receive Disable
	TMOD&=T0_MASK_;
	TMOD|=T1_M1_;
	TH1=0xfa;		//9600bps
	TL1=0xfa;
	//PS=1;			//serial port to high prior
	//ES=1;
}
//------------------------------------------------------
void SendChar(unsigned char SendChar){
	TI=0;
	SBUF=SendChar;
	while(!TI);
}
//------------------------------------------------------
#ifdef MONITOR51				// Monitor-51 needs
char code reserve[3] _at_ 0x23;	// serial interrupt if
#endif
//------------------------------------------------------

⌨️ 快捷键说明

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