2.7 SDA and SCL Pins
The Serial Data (SDA) and Serial Clock (SCL) pins are used by the I2C module to control the I2C bus lines. Unlike previous versions of the MSSP, the SCL and SDA pins must be configured in open-drain operation by setting the appropriate bits in that port’s Open-Drain Control register (ODCONx). Also, unlike previous versions of the MSSP, the port’s Direction Control register (TRISx) must have the SDA and SCL pins configured as outputs by clearing the appropriate TRIS bits. Finally, slew rate control, internal pull-up resistor selection, and input threshold levels for each pin can be configured using the I2C Pad Control (RxyI2C) register.
The SDA and SCL pins are typically assigned to two I/O port pins and must be enabled using the Peripheral Pin Select (PPS) module. The PPS module has two dedicated I2C input registers: I2CxSCLPPS, which defines the SCL input pin, and I2CxDATPPS, which defines the SDA input pin. SDA and SCL outputs are also defined via the PPS module. The outputs use the RxyPPS registers to define the signal the pin will output.
The PPS module also allows for alternate pins to be used instead of the default pin locations. If an alternate pin location is desired, simply load the appropriate PPS registers with the new location.