PIC24F16KA102 SPI problem with MCP795W10 RTCC chip
hello i fix the probleme i removed the interrupt and i wait for an answer when i wirte to to rtc see my code bellow thanks for your time

void configSpi() {
SPI1STATbits.SPIEN      = 0;
SPI1BUF                 = 0;
IFS0bits.SPI1IF = 0; //clear spif see datasheet
IEC0bits.SPI1IE = 0; //enable spi interrupt
IPC2bits.SPI1IP = 0b100;
SPI1CON1bits.DISSCK = 0;
SPI1CON1bits.DISSDO = 0;
SPI1CON1bits.MODE16 = 0;
SPI1CON1bits.SSEN = 0;
SPI1CON1bits.SMP = 0;
SPI1CON1bits.MSTEN = 1;
SPI1CON1bits.CKP = 0;
SPI1CON1bits.CKE = 1;
SPI1CON1bits.SPRE = 0b110;
SPI1CON1bits.PPRE = 0b11;
//SPI1STATbits.SISEL=0b101;
SPI1STATbits.SPIROV = 0;
SPI1CON2bits.FRMEN = 0; // desactivation du mode framed
SPI1CON2bits.SPIBEN = 0;    // desactivation du buffer
SPI1STATbits.SPIEN = 1;     
LATBbits.LATB12 = 1;


}

and this is for writing and reading

unsigned short writeSPI1( unsigned short data ){
SPI1BUF = data;                 // write to buffer for TX
while(!SPI1STATbits.SPIRBF);    // wait for transfer to complete
return SPI1BUF;                 // read the received value
}//writeSPI1