Currently, i am coding for the microcontroller SPI and learning related code samples. Anybody could describe me the usage and difference between transmit buffer registers and receive buffer registers (TXBn & RXBn). I search online but do not find very good example to explain it
In certain microcontrollers/processors, the receive buffer register shall get updated while data reception(i.e, it shall have the received data). This register shall be checked by either polling or in the form of interrupt on packet arrival and accordingly the packet shall be transferred/processed. Generally, there may be provision to set an INT flag before reading and clearing it after reading.
The transmit buffer register stores the data to be transferred. This too may have a INT flag to convey whether the transmission has happened or is still present. This shall be checked before writing data to ensure that the data is being written into it only after the earlier data has been sent out or to avoid overwriting of data.
Nowadays, many microcontrollers/processors have mechanisms in the form of multiple queues and related status register for transmission and reception.