471
void __interrupt() ISR(void) { if (SSPIF) { // Check if I2C interrupt flag is set if (!D_nA && R_nW) { // Check if it is an address match and read request volatile char dummy = SSPBUF; // Clear the buffer SSPBUF = PORTB; // Load the DIP switch state into the buffer CKP = 1; // Release the clock while (BF); // Wait until the buffer is clear } CKP = 1; // Release the clock SSPIF = 0; // Clear the interrupt flag } }