Trotzdem vielen Dank! Hier jetzt mal die wesentlichen code Zeilen, die ich für I2C geschrieben habe.

__CONFIG(FOSC_INTOSC & WDTE_OFF);
__CONFIG(LVP_OFF & BORV_25 & STVREN_ON & PLLEN_ON);

void main(void)
{
OSCCON = 0b01101000; //bit7: PLL, bit6-3: 4 MHz internal Clock
OSCSTAT |= 0b00100000; //Start-up Timer on

I2C_Init();

While(1)
SSP1BUF = 0b00000000;
}



void I2C_Init(void)
{
TRISA |= 0b00000110; //SDA and SCL as Input

//SSP1STAT
SSP1STATbits.SMP = 1; //slew rate controll off
SSP1STATbits.CKE = 1; //SMBus disabled

//SSP1CON1
SSP1CON1 = 0x00;
SSP1CON1bits.SSPEN = 1; //initiate SDA and SCL as serial port pins
SSP1CON1 |= 0b00001000; //Master mode
SSP1CON1bits.CKP = 0; //Initiate start condition on SDA and SCL

//SSP1CON2
SSP1CON2bits.GCEN = 0; //Interrupt when general call adr. (0x00) is received in the SSP1SR
SSP1CON2bits.RCEN = 1; //Receive mode enabled
SSP1CON2bits.PEN = 1; //Initiate stop condition enabled. Automatically cleared by hardware
SSP1CON2bits.RSEN = 1; //Repeated start condition

//SSP1CON3
SSP1CON3bits.SBCDE = 1; //Collison Interrupt enabled. See BCL1IF bit in PIR2

SSPADD = 0x09; //FOSC: 4 MHz, Fcy: 1MHz, Fclock
SSP1CON2bits.SEN = 1; //Initiate start condition on SDA and SCL
}