السلام عليكم عندي مشكله بهاد الكود , الرجاء المساعده

وشكراا
////////////////////////////////////////////////////////////////////////////////
void I2C_init(void);
void I2C_Start(void);
void I2C_Stop(void);
void I2C_Repeted_Star();
unsigned char I2C_Write(unsigned char DAT);
unsigned char I2C_Read(unsigned char ack);
unsigned char I2C1_Bus_IsFree();
////////////////////////////////////////////////////////////////////////////////
void I2C_Init()
{
TRISCbits.TRISC3 = 1; //make C3 input
TRISCbits.TRISC4 = 1; //make C4 input
APFCONbits.SCKSEL = 0; //SCL is on pin RC3
APFCONbits.SDISEL = 0; //SDA is on pin RC4
INTCON = 0xC0; //Enables all active interrupts & all active peripheral interrupts
PIE1bits.SSP1IE = 1; //Enables the MSSP interrupt
PIE2bits.BCL1IE = 0; //Disables the MSSP Bus Collision Interrupt it flag BCL1IF ,
SSPADD = 0x09; //For 100k clock rate
SSPSTATbits.SMP = 1; //Slew rate control disabled
SSPCON1 = 0x38; //Enables the serial port(SSPEN) and configures the SDA and SCL pins & Enable clock
//I2C Master mode, clock = FOSC / (4 * (SSPADD+1))=> 4000000/((9+1)*4) = 100khz
SSPSTATbits.CKE = 0; //Disable SMBus specific inputs
SSPCON3bits.PCIE = 1; //Enable interrupt on detection of Stop condition
SSPCON3bits.SCIE = 1; //Enable interrupt on detection of Start or Restart conditions
SSPCON3bits.SDAHT = 0; //Minimum of 100 ns hold time on SDA after the falling edge of SCL
PIR1bits.SSP1IF = 0;
}
////////////////////////////////////////////////////////////////////////////////
void I2C_Start()
{
SSPCON2bits.SEN = 1;
while(PIR1bits.SSP1IF == 0);
PIR1bits.SSP1IF = 0;
}
////////////////////////////////////////////////////////////////////////////////
unsigned char I2C_Write(unsigned char DAT)
{//0
SSPBUF=DAT;
while(PIR1bits.SSP1IF == 0);
PIR1bits.SSP1IF = 0;
return ACKSTAT; // 0 there is ACK , 1 NACK,
}
////////////////////////////////////////////////////////////////////////////////
unsigned char I2C_Read(unsigned char ack)
{//1
unsigned char DA1;
if(SSPCON1bits.SSPOV==1) // if previous data had not been read from the SSPBUF so we must read it;
DA1=SSPBUF;
SSPCON2bits.RCEN=1;
while(SSPSTATbits.BF == 0);
//while(PIR1bits.SSP1IF == 0); //wait to complet receive data ,
PIR1bits.SSP1IF = 0;
DA1=SSPBUF; //raed data, to receive more byte send ACK (SDA=ACKDT=0)
if(ack == 1)SSPCON2bits.ACKDT=0; //to receive more byte send ACK (SDA=ACKDT=0)
else SSPCON2bits.ACKDT=1; //to stop receive byte send NACK (SDA=ACKDT=1)
SSPCON2bits.ACKEN=1;
while(PIR1bits.SSP1IF == 0); //wait to end ack,
PIR1bits.SSP1IF = 0;
return DA1;
}
////////////////////////////////////////////////////////////////////////////////
void I2C_Stop()
{
SSPCON2bits.PEN=1;
while(PIR1bits.SSP1IF == 0);
PIR1bits.SSP1IF = 0;
}
////////////////////////////////////////////////////////////////////////////////
unsigned char I2C_Bus_Is_Free()
{
if(SSPSTATbits.P == 0 && SSPSTATbits.S ==1 ) return 1; //the bus is busy now,
return 0;
}
////////////////////////////////////////////////////////////////////////////////
void I2C_Repeted_Star()
{
SSPCON2bits.RSEN=1;
while(PIR1bits.SSP1IF == 0);
PIR1bits.SSP1IF = 0;
}
and this in main.c
ANSELB =0x00;
ANSELA =0x00;
WPUA =0x00;
WPUB =0x00;
APFCON =0x00;
TRISB =0x00;
ADCON0bits.ADON =0;
DACCON0bits.DACEN=0;
CM1CON0bits.C1ON =0;
CM2CON0bits.C2ON =0;