How to chnge the mode (port p3.0 and port p3.1 to serial port) of the at89c51. i need the source code
No, what you want is the source code.
What you really should get is the datasheets for the chip.
Then, the code needed to initialize the port would not be some form of black magic.
u can get it from keil example "hello"