 #include    "reg51.h"

#define system_clk 24000000L 
#define BAUD 9600
#define TM   (65536 -(system_clk/BAUD/4))

sfr AUXR = 0x8E;
sfr T2H  = 0xD6;
sfr T2L  = 0xD7;

void UartStdOutInit(void)
{
	SCON = (SCON & 0x3f) | 0x40; 
	T2L  = TM;
	T2H  = TM>>8;
	AUXR = 0x15;
}
 
// Output a character
void UartPutc(unsigned char my_ch)
{
  SBUF = my_ch; 
	while (TI == 0); 
	TI = 0;
}
 
char putchar(char c)
{
	UartPutc(c);
	return c;
}
