Now I2C comunication is working in my pic16F873.
I'm doing step forward...Interrupt.
In the slave code i have:
INTCONbits.GIE = 1
INTCONbits.INTE = 1
Others INTCONbits are 0.
In the Interrupt zone i wrote:
void interrupt I2C_Slave_Read()
if (sensore_rallenta) //Interrupt from Port RB0 sensor
INTCONbits.T0IF = 0; //register reset
Interrupt_Porta_RB0(); //routine: reducing train speed
// I2C sending/receiving
If i mask "sensore rallenta" the code works well, but i need to checkig the input on RB0, because when it will be the program must to reducing speed on a train motor.
So, i let unmasked it and when RB0 is true the I2C on this device goes down, i have 4 slave for now, and the RB0 doesn't work any more.
Is correct on this micro i can't use priority level? If i write high_pripority or low_priority in interrupt prototype XC8 return me an error level.
If i write irq(RB0) for exampre in the prototype XC8 return an error too.
I think the code writed like i do is wrong. I haven't find any axample including I2C and RB0 or other.
Have you some suggestions?