We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The 8051 has only single SBUF register. But the datasheet say it can support full duplex. for full duplex communication we must have different buffers(?) for transmitting and receiving. how a single byte SBUF register work as two registers ?
from the site www.edsim51.com/.../serial.html Unlike any other register in the 8051, SBUF is in fact two distinct registers - the write-only register and the read-only register. Transmitted data is sent out from the write-only register while received data is stored in the read-only register. There are two separate data lines, one for transmission (TXD) and one for reception (RXD). Therefore, the serial port can be transmitting data down the TXD line while it is at the same time receiving data on the RXD line.
how the single buffer register act as two?
It's a pair of peripheral registers, implemented with different latches and logic, stop thinking of it as a RAM memory.
There are likely more than 16 flip-flops involved
Time to study the so-called "bible" for the 8051 - a copy is archived for reference here:
www.danlhenry.com/.../80C51_FAM_ARCH_1.pdf www.danlhenry.com/.../80C51_FAM_HARDWARE_1.pdf www.danlhenry.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Specifically, look at the Standard Serial Interface section (starting on page 9) in the 80C51 Family Hardware Description:
www.danlhenry.com/.../80C51_FAM_HARDWARE_1.pdf
And, in particular, look at the block diagrams in Figures 15 - 16: where you can clearly see the two SBUF registers - one with only Read access from the "80C51 Internal Bus"; the other with only Write access (look at the directions of the arrows).
The Problem with so called Bible we have to go through number of times to barely Understand it for begineers like me.
the 8051 UART is capable of Full duplex system.. But can we really implement full duplex on it? any code examples is very useful.
If "we" can implement full duplex depends on the skills "we" have.
When implementing full duplex code, it doesn't matter if the processor has separate addresses for read and write data registers, or if the read-only receive register shares address with the write-only transmit register.
Full duplex is just a question of picking up received characters when the processor flags received data as available, and giving the UART more characters when the processor flags that the UART has room for more outgoing characters. Then it's just a question of selecting polling code or making use of interrupts. And if the code should contain some robust round-robin buffers so the main loop doesn't have to be 100% in lock-step with the speed the UART can handle individual characters.