508
void I2C_Slave_Init(unsigned char address) { SSPADD = address; // Set the I2C slave address SSPSTAT = 0x80; // Slew rate control disabled SSPCON = 0x36; // Enable clock stretching and set slave mode SSPCON2 = 0x01; // Enable general call TRISC3 = 1; // Set SCL as input TRISC4 = 1; // Set SDA as input GIE = 1; // Enable global interrupts PEIE = 1; // Enable peripheral interrupts SSPIF = 0; // Clear SSP interrupt flag SSPIE = 1; // Enable SSP (I2C) interrupt }