Is that the CCS compiler? On the slave, you pole to find out if you have received your address, once you get that, you start getting the bytes. Look at the example code that comes with the compiler, and walk through the EE emulation program, notice it is using the next byte read mode as well as the random read mode. don't forget to put your "stop" back in the master. sorry I can't be more specific, but I am working from memory. Best regards, Giles ----- Original Message ----- From: Ken Finnegan To: Sent: Sunday, April 16, 2000 3:33 PM Subject: [PICLIST] I2C CHALLANGE > PIC People, > I have been working on an I2C problem for the past 3/4 > days. All I want to do is get 2 PICs talking to each > other (16c73a), but I think either there is somthing > fundamentally wroung in my Rx & Tx progs or my > compiler is messed up. > The code is down below. > If anyone would like to take a look and let me know if > I am making some collosal problem or whether its my > compiler, I would be gracious. > > Later Ken > #include <16C73a.H> > #use delay(clock=40000000) > file://#use fixed_io(a_input=pin_a0) > #byte port_b=6 > #byte port_a=5 > file://#fuses XT, NOWDT, PUT, NOPROTECT//, NOBROWNOUT > #define SLAVE_ADDRESS 0b1111000 > #use I2C (master, sda = pin_c4, scl = pin_c3, address > = 0x11, NOFORCE_SW) > byte intI; > > > > main() > { > while (1){ > set_tris_b (0x00); > intI = 02; > port_b=intI; > > i2c_start(); > i2c_write( 0XA0); /* first byte is slave's > 7-bit address plus R/W bit (set by hardware) */ > // delay_ms(250); > // delay_ms(250); > i2c_write( inti); > // delay_ms(250); > // delay_ms(250); > > /* second byte is data to send to slave > */ > // i2c_stop(); > > } > } > > and the rx prog is > > #include <16C73a.H> > #use delay(clock=40000000) > #byte port_b=6 > #use I2C (slave, sda = pin_c4, scl = pin_c3, address = > 0XA0,slow, NOFORCE_SW) > int no1=0x00; > > Main() > { > set_tris_b(0x00); > > while(1) > { > > if(i2c_poll()) > no1=0x04; > port_b=no1; > } > } > > ===== > Ken Finnegan > +61-333087 > KENFIN@YAHOO.COM > 9637834@student.ul.ie > > __________________________________________________ > Do You Yahoo!? > Send online invitations with Yahoo! Invites. > http://invites.yahoo.com >