www.pudn.com > FLUX-SENSOR-GSM-WITH-VOICE.rar > serial.c, change:2012-02-05,size:706b


//--------------------------------------- 
// Serial prt driver 
 
// KEIL C51 v7.5 
// www.GetMicro.com 
//--------------------------------------- 
 
#include <At89X52.H> 
 
//--------------------------------------- 
// Initialize serial port 
//--------------------------------------- 
void InitSerial(void) 
{ 
  	SCON = 0x50;    // setup serial port control  
  	TMOD = 0x20;    // hardware (9600 BAUD @11.05592MHZ)  
  	TH1  = 0xFD;    // TH1 
	TR1	 = 1;  
	 		// Timer 1 on 
} 
 void send(unsigned char nam) 
 { 
	    SBUF=nam;  
		while(TI==0); 
	    TI=0; 
	 
 } 
 
 void send1(unsigned char *nam) 
 { 
 	while(*nam!='\0') 
	{ 
	    SBUF=*nam;  
		while(TI==0); 
	    TI=0; 
		nam++; 
	} 
 
 }