/*
* Project name:
8051 Development Board
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: AT89S52
Dev.Board: 8051
Oscillator: 11.0592 MHz
Software: Keil uVision3
*/
#include<reg51.h>
unsigned char SCI_ReceiveByte( void );
void TRANSMIT(unsigned char *);
void transmit_byte(unsigned char );
void DELAY();
void main()
{
unsigned char byte;
TMOD=0X20;
TH1=0XFD;
SCON=0X50;
TR1=1;
TRANSMIT("RESEARCH DESIGN LAB");
DELAY();
while(1)
{
byte=SCI_ReceiveByte();
transmit_byte(byte);
}
}
void DELAY()
{
unsigned int X=6000000;
while(X--);
}
void transmit_byte(unsigned char byte)
{
SBUF=byte;
while(!TI);
TI=0;
}
void TRANSMIT(unsigned char *string)
{
while(*string)
transmit_byte(*string++);
}
unsigned char SCI_ReceiveByte( void )
{
unsigned char byte;
while(RI!=1);
byte = SBUF;
RI=0;
return byte;
}