How to print data from register(8051) to terminal(serial monitor)
//make stdin, stdout and stderr point to the debug usart
static int putChar(char c, FILE *out);
static int getChar(FILE *in);
static FILE fileInOutErr = FDEV_SETUP_STREAM(putChar, getChar, _FDEV_SETUP_RW);


This is how it's done for an AVR. The definitions of the functions are trivial:

//uart
static int putChar(char c, FILE *out){
        USARTtransmit(c);
        return 0;       //SUCCESS
}

static int getChar(FILE *in){
        unsigned char c;
        USARTreceive(&amp;c);
        return (int)c;  //SUCCESS
}


And then you fire up minicom or some other serial console on the PC and communicate.