29.2.1 I2C Mode Registers
The MSSP module has eight registers for I2C operation.
These are:
- MSSP Status Register (SSPxSTAT)
- MSSP Control 1 Register (SSPxCON1)
- MSSP Control 2 Register (SSPxCON2)
- MSSP Control 3 Register (SSPxCON3)
- Serial Receive/Transmit Buffer Register (SSPxBUF)
- MSSP Address Register (SSPxADD)
- I2C Client Address Mask Register (SSPxMSK)
- MSSP Shift (SSPSR) register – not directly accessible
SSPxCON1, SSPxCON2, SSPxCON3 and SSPxSTAT are the Control and Status registers in I2C mode operation. The SSPxCON1, SSPxCON2 and SSPxCON3 registers are readable and writable. The lower six bits of the SSPxSTAT are read-only. The upper two bits of the SSPxSTAT are read/write. SSPxMSK holds the client address mask value used in address comparison. SSPxADD contains the client device address when the MSSP is configured in I2C Client mode. When the MSSP is configured in Host mode, SSPxADD acts as the Baud Rate Generator reload value.
SSPSR is the shift register used for shifting data in or out. SSPxBUF is the buffer register to which data bytes are written to or read from. In receive operations, SSPSR and SSPxBUF together, create a double-buffered receiver. When SSPSR receives a complete byte, it is transferred to SSPxBUF and the SSPxIF interrupt is set. During transmission, the SSPxBUF is not double-buffered. A write to SSPxBUF will write to both SSPxBUF and SSPSR.