Auto-Load I2CxCNT

The I2CxCNT register can be automatically loaded. Auto-loading of the I2CxCNT register is enabled when the Auto-Load I2C Count Register Enable (ACNT) bit is set (ACNT = 1).

In Master Transmit mode, the first byte following either the 7-bit or 10-bit slave address is transferred from I2CxTXB into both I2CxCNT and the transmit shift register.

In Master Reception mode, the first byte received from the slave is loaded into both I2CxCNT and I2CxRXB. The value of the Acknowledge Data (ACKDT) bit is used as the master’s acknowledgement response to prevent a false NACK from being generated before the I2CxCNT register is updated with the new count value.

In Slave Reception mode, the first byte received after a receiving a matching 7-bit or 10-bit address is loaded into both I2CxCNT and I2CxRXB, and the value of the ACKDT bit is used as the slave’s acknowledgement response.

In Slave Transmit mode, the first byte loaded into I2CxTXB following the reception of a matching 7-bit or 10-bit address is transferred into both I2CxCNT and the transmit shift register.

Important: It is not necessary to preload the I2CxCNT register when using the auto-load feature. If no value is loaded by the 9th falling SCL edge following an address transmission or reception, the Byte Count Interrupt Flag (CNTIF) will be set by module hardware, and must be cleared by software to prevent an interrupt event before I2CxCNT is updated. Alternatively, I2CxCNT can be preloaded with a non-zero value to prevent the CNTIF from being set. In this case, the preloaded value will be overwritten once the new count value has been loaded into I2CxCNT.