Hey All, I have been trying to implement a basic I2C demonstration between 2 PIC 16F877s using CCS PIC C. One PIC is the master and the other the slave. Unfortunately I am a bit unclear about the wiring and the code. So, if anyone out there has the inclination, I have a couple of questions: First, do I need to have a common ground between the PICs? I have tried the following master and slave code with several different wiring configurations but none seems to work, any ideas? MASTER: #include <16F877.h> #fuses XT,NOWDT,NOPROTECT,NOLVP,PUT /* Delay for 4 mhz crystal */ #use delay (clock=4000000) /* Setup RS232 */ #use rs232(baud=9600, xmit=PIN_D4,rcv=PIN_D5, INVERT) /* Setup I2C */ #use I2C(MASTER, sda=PIN_C4, scl=PIN_C3, SLOW) main() { char send_char = 65; int8 i2c_command = 66; while (true) { delay_ms(100); putc(send_char); delay_ms(100); putc(send_char+1); delay_ms(100); /* Master */ i2c_start(); // Start condition i2c_write(0xa0); // Device address i2c_write(i2c_command); // Write Command i2c_stop(); // Stop condition } } SLAVE: #include <16F877.h> #fuses XT,NOWDT,NOPROTECT,NOLVP,PUT /* Delay for 4 mhz crystal */ #use delay (clock=4000000) /* Setup RS232 */ #use rs232(baud=9600, xmit=PIN_D4,rcv=PIN_D5, INVERT) /* Setup I2C */ #use i2c(SLAVE, SDA=PIN_C4, SCL=PIN_C3, address=0xa0, SLOW, FORCE_HW) #INT_SSP void ssp_interupt () { byte incoming; incoming = i2c_read(); putc(incoming); } main() { char send_char = 65; int received_char = 0; int i2c_received; while (true) { delay_ms(100); putc(send_char); enable_interrupts(GLOBAL); enable_interrupts(INT_SSP); /* Slave */ ////i2c_start(); ////i2c_write(0xa1); //i2c_received = i2c_read(1); ////i2c_stop(); //putc(i2c_received); } } -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads