I am trying to configure the port b interrupt on change interrupts to work with a program I am writing with MC XC8 demo version. I am using a PIC16F628A I am using this code to initialize the pic for interrupt reading. However it seems when I start up my program an interrupt is called. I don't understand why this is happening as the datasheet says interrupts will only be generated for pins set as an input and I have set all of port B to be output. Could someone please explain this strange behavior
int main()
{
TRISA2 = 0;
TRISA3 = 0;
PORTB = 0;
TRISB = 0;
CMCON = 0x07;
initialise();
writeCommand(0b00001111);
writeCommand(0b00000110);
writeString("Hello World ", 11);
GIE = 1;
RBIE = 1;
PEIE = 0;
while(1);
}
void interrupt interruptRoutine()
{
if(RBIF)
{
writeString("Interrupt", 9);
RBIF = 0;
}
}