Searching \ for 'CCS C Compiler I2C Slave Mode' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/i2cs.htm?key=i2c
Search entire site for: 'CCS C Compiler I2C Slave Mode'.

Truncated match.
PICList Thread
'CCS C Compiler I2C Slave Mode'
1998\10\06@164832 by Bob Carter

flavicon
face
Hello,

I am trying to get two PICs to talk to each other, using the I2C
protocol. My Master is using software routines (16C67), while my slave is
using the harware port (16C62A). For my basic test, I am passing data
Master->Slave, then returning data Slave->Master. The data I am getting
back at the Master is showing all 255's. I have been using Master Mode
for a couple of years without problems but this is my first attempt at
the Slave Mode, so I suspect the problem may be on the Slave side. Below
is the form that I am using for the Master and Slave, based on CCS's C
compiler.

//Master
i2c_start();
i2c_write(0x80); //device address
i2c_write(byte1);
i2c_write(byte2);
i2c_write(byte3);
i2c_write(byte4);
i2c_write(byte5);
i2c_write(byte6);
i2c_stop();
i2c_start();
i2c_write(0x80); //device address
byte7=i2c_read();
byte8=i2c_read();
byte9=i2c_read();
byte10=i2c_read();
byte11=i2c_read();
i2c_stop();


//Slave
#use i2C(slave, sda=sda_cu, scl=scl_cu, address=0x80, noforce_sw)
byte12=i2c_read();
byte13=i2c_read();
byte14=i2c_read();
byte15=i2c_read();
byte16=i2c_read();
byte17=i2c_read();
//do stuff here that takes processing time
i2c_write(byte18);
i2c_write(byte19);
i2c_write(byte20);
i2c_write(byte21);
i2c_write(byte22);


Thanks,
Bob Carter, design engineer

Wildlife Materials, Inc.
1031 Autumn Ridge Road
Carbondale, IL   62901

voice (618) 549-6330 (ext. 225)
fax   (618) 457-3340
email spam_OUTwolftechTakeThisOuTspammidwest.net
www   http://www.wildlifematerials.com

1998\10\07@154351 by Rich Lundeen

flavicon
face
i just recently received the ccs compiler, so i am not an expert on their
built in functions, but i believe that when you want to read from the
slave(s) you must logically or the slave address with 1 to set the
read/write bit.  this is shown in some of the example programs.  i too am
interested in using i2c in both master and slave mode with the pics, so let
me know what you find.

regards,
rich lundeen



{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...