Dave, this piece of code works for me. void __INT(void) { save_context; if(PIR1.SSPIF) { PIR1.SSPIF = FALSE; // Clear I2C interrupt flag I2C_InterruptServiceRoutine(); // decode I2C message Transmit or receive } restore_context; return; } void I2C_Initialize(void) { SSPCON= 0x3e; PIE1.SSPIE = TRUE; SSPADD = I2C_SLAVE_ADDRESS; TRISC.3 = HIGH; TRISC.4 = HIGH; PIR1.SSPIF = FALSE INTCON.PEIE = TRUE ReceiveIndex = 0; I2cTransmitBusy = FALSE; TransmitIndex = 0; } void I2C_InterruptServiceRoutine(void) { if (SSPSTAT.BF) //buffer full { I2C_ReceiveBuffer[ReceiveIndex] = SSPBUF; ReceiveIndex++; } if (SSPSTAT.P) // stop detected { TransmitIndex = 0; ReceiveIndex = 0; I2C_ReceiveInterpreterTask(); I2cTransmitBusy = FALSE; } if(SSPSTAT.R) // restart detected { I2C_TransmitInterpreterTask(); } } void I2C_ReceiveInterpreterTask(void) { switch(I2C_ReceiveBuffer[1]) { case LAS_CMD_START_LASEROUTPUT: LAS_SetSelectedLaser(I2C_ReceiveBuffer[2]); DBS_LaserMode = LAS_MAIN_ON_STATE; break; case ..... break; } } void I2C_TransmitInterpreterTask(void) { switch(I2C_ReceiveBuffer[1]) { case LAS_CMD_READ_STATUS: if (I2cTransmitBusy == FALSE) { I2cTransmitBusy = TRUE; TransmitIndex = 0; I2C_TransmitBuffer[0] = DBS_LaserMode; I2C_TransmitBuffer[1] = DBS_LaserCurrent; I2C_TransmitBuffer[2] = DBS_LaserCurrent; I2C_TransmitBuffer[3] = BS_LaserFrequencyHB; I2C_TransmitBuffer[4] = DBS_LaserFrequencyLB; I2C_TransmitBuffer[5] = DBS_LaserFlags; } SSPBUF = I2C_TransmitBuffer[TransmitIndex++]; SSPCON.4 = TRUE; break; case ..... break; } } ______________________________ Frank Temmerman Gymna R&D EMAIL: gymna@compuserve.com TEL: +32 (0)89 510 535 FAX: +32 (0)89 510 511 ______________________________