#include <stc15.h>    	       //婦漪盓厥IAP15W4K58S4等え儂腔芛恅璃
#include <intrins.h>
#include <gpio.h>					 //I/O場宎趙恅璃
#define uchar unsigned char
#define uint  unsigned int
#include <display.h>
uchar code as[]="Receving Data:";	
uchar a=0x30;				
/*求求求求求求求求求揹俴諳場宎趙滲杅求求求求求求求求求*/
void UartInit(void)		//9600bps@12.000MHz
{
	SCON = 0x50;		//8弇杅擂,褫曹疏杻薹
	AUXR |= 0x40;		//隅奀ん1奀笘峈Fosc,撈1T
	AUXR &= 0xFE;		//揹諳1恁寁隅奀ん1峈疏杻薹楷汜ん
	TMOD &= 0x0F;		//扢隅隅奀ん1峈16弇赻雄笭蚾源宒
	TL1 = 0xC7;		//扢隅隅奀場硉
	TH1 = 0xFE;		//扢隅隅奀場硉
	ET1 = 0;		//輦砦隅奀ん1笢剿
	TR1 = 1;		//ゐ雄隅奀ん1
}

/*-------------------翋滲杅-----------------------*/
void main(void)				
{	
	uchar i;
	gpio();			
	UartInit();	
	ES=1;
	EA=1;	   
    while(1)	        	
    {				
		Dis_buf[0]=a-0x30;		
		display();
		if(RI)		             	//潰聆揹俴諉彶梓祩
		{
			RI=0;i=0;              	   //ь錨RIㄛ甜甡棒楷冞啎离趼睫揹迵諉彶杅擂
			while(as[i]!='\0'){SBUF=as[i];while(!TI);TI=0;i++;}
			SBUF=a;while(!TI);TI=0;			
			ES=1;                    	//羲笢剿ㄛ眕諉彶狟珨跺PC儂楷冞杅擂
		}
    }					
}		
/*求求求求求求求求求求求求揹諳笢剿督昢滲杅求求求求求求求求求求求求求求*/
void serial_serve(void) interrupt 4	 	
{					
	a=SBUF; 
	ES=0;                       	//黍揹俴諉彶杅擂 
}	
