I want to interface RS485 with pic18f452 . But when i send data the same data is available on the receiving pin of microcontroller and a logical contention is also there? why?
I presume you are using a RS485 transceiver, it has TE (transmit enable) and /RE (not receive enable) pins that must be controlled by the µC. A popular method is to connect both pins to transmit enable, so when TE is asserted while sending, the receiver is also disabled at the same time. A pullup resistor is additionally needed at the transceiver RX output to keep the inactive high state.
In some applications, it's however wanted to receive while transmitting to check for possible collisions.