To connect 2 51 microcontrollers you even dont need drivers (unless they are some distance apart). Just connect Rx os the first on with Tx of the second one and Tx of the first one with Rx of the second one + Common GND and your hardware is ready.
You will have to set-up boyh UART for the same baud-rate and configuration.
Other thing to consider is the use of serial port interrupts.
Another issue is the use of command-response protocol but this may put one controller in MASTER position and the other in SLAVE.
"Patterns for time triggered Embedded systems" by M. J. Pont
(for 8051 micros)
in chapter 27 is presented a complete solution
One uC is declared master, and others are declared slaves.
Master emit 9 bit messages: 8bits=data (or adress for the selected slave)
Distinction between 8 bit data or 8bit adress of the slave is made by the 9'th bit emited by the master
UART is in mode 3 for both masters and slaves
Unfortunately an eletronic version of the "bible" doesn't exist , anyway here is some sample code in C (K*il) to get a fillng:
I would find the master and slave in the scheduler approach very useful for my future project but I only want to send data across to another AT89C51 (Receiver) in one way mode via wire.
For example, the first AT89C51 is designed to send a temperature reading across the wire to another AT89C51. That's it
Check attached file. You should use function UART_CommInit to initialize once every of two uC UARTs. Then one uC can use function UART_Putchar to send single char to another uC. And second uC will use UART_Getchar to receive this char. Also, to send more than one char you can use function UART_Printf.
This small UART lib is interrupt-driven with send/receive buffers, so you don't have to worry to check state of UART before sending/receiving new char. Buffer size is defined by TBUF_SIZE constant.
i have made a serial communication between 89c2051 and 89c51 ,
but i didn't get a good results ,
i guessed it is because of their ossilators are seprate , i mean sender may change data when receiver is sampling input , so an invalid data whould be received ,
i at last wrote a program using 2 input/output pin for serial communication , but this way it was too slower than a ready UART .
i have talked about this problem in :
i have made a serial communication between 89c2051 and 89c51 ,
but i didn't get a good results ,
i guessed it is because of their ossilators are seprate , i mean sender may change data when receiver is sampling input , so an invalid data whould be received ,
UART uses an asynchronous protocol, so separate oscillators have nothing related to your problem and you should search for bug in your program, especially in initialization procedure.