The I2C module has a dedicated transmit buffer, I2CxTXB, which is independent from the receive buffer.
1), or a data byte, that is copied into
the transmit shift register and transmitted onto the bus. When the I2CxTXB register does
not contain any transmit data, the Transmit Buffer Empty Status (TXBE) bit is set (TXBE = 1), allowing user
software or the DMA to load a new byte into the buffer. When the TXBE bit is set and the
I2CxCNT register is non-zero I2CxCNT( != 0), the
I2C Transmit Interrupt Flag (I2CxTXIF) bit of the PIR registers is set,
and can be used as a DMA trigger. A write to I2CxTXB will clear both the I2CxTXB and
I2CxTXIF bits. Setting the Clear Buffer (CLRBF) bit clears I2CxTXIF, the I2Cx Receive Buffer (I2CxRXB) and I2CxTXB.1), the Transmit Underflow Status (TXU) bit is set, I2CxTXB is loaded with 0xFF,
and a NACK is generated.1). Clock stretching prevents
transmit underflows because the clock is stretched after the 8th falling SCL edge, and
is only released upon the write of new data into I2CxTXB.