I am working on how 8051 performs serial communication. I couldn't figure out how both transmission and receive operations are performed by same register, SBUF.
To make it more clear, I will give an example. Assume that I'm receiving information through Rx pin continuously. What if I want to transmit information? How can I interrupt receiving while transmitting data because I don't want the data that I put in SBUF register to be replaced by the incoming data.
There were two bits in SCON, namely receive interrupt(RI) and transmit interrupt(TI), but they were used to check whether the data is received or transmitted succesfully, not to decide whether the chip is gonna transmit or receive.
What I'm asking is, shouldn't there be a bit in SCON like transmit enable or receive enable which allows one operation and inhibits the other when asserted. There is actually one receive enable(REN) in SCON but in all examples it was asserted both when transmitting and receiving so I thought this bit was for something else.
What is it I'm missing?