#include <REGX52.H>
#include <stdio.h>
#define FOSC 11059200UL // Crystal frequency
#define BAUD_RATE 19200UL // 19.2 kbps
#define BAUD_CONST 256-(unsigned char)(2 * FOSC/(BAUD_RATE * 12 * 32))
void main(void)
{
// Init serial port
PCON = 0x80; // Double Baud Rate
SCON = 0x50; // SCON: mode 1, 8-bit UART, enable rcvr
TMOD |= 0x20; // TMOD: timer 1, mode 2, 8-bit reload
TH1 = BAUD_CONST; // TH1: reload value
TR1 = 1; // TR1: timer 1 run
TI = 1;
RI = 0;
printf("Hello world!");
while(1);
}