4.2 Transmit-Only Mode

A feature unique to this SPI module is the ability to configure the master to operate in Transmit-Only mode. While in this mode, any data that is received will not be stored in the RXFIFO and the SPI master will continue transmitting data via the transmit buffer. To configure the SPI module as a master in Transmit-Only mode, the TXR bit of the SPIxCON2 register must be set, and the RXR bit of the SPIxCON2 register must be cleared. Depending on the status of the BMODE bit, a value may need to be written to the transfer counter to initiate the SPI to begin transferring data. The example below demonstrates the basic configuration of the SPI module in Transmit-Only mode.

CONFIGURATION OF A SPI MASTER IN TRANSMIT ONLY MODE

uint8_t SPI1_Master_TransmitOnly (uint8_t data)
{
SPI1CON2bits.TXR = 1; //Transmit Data-Required Bit;
SPI1CON2bits.RXR = 0; // Receive FIFO Space-Required Bit;
SPI1TCNT = 1; // Load SPI Transfer Counter;
SPI1TXB = data; // Write Data to SPI Transmit Buffer;
}