nanard_bis
Joined: 07 May 2004 Posts: 1
|
HELP my i2c slave transmetter don't work right |
Posted: Mon Oct 04, 2004 2:56 am |
|
|
Hello,
I am deseperate because i search a sample code for transmit data
slave to master i2c.LOOK my code
/******Master*********/
#include <16F877.H>
#use I2C(master,sda=pin_C4,scl=pin_C3,FORCE_HW)/
main()
{
i2c_start();
i2c_write(0xa1);
delay_us(50);
a=i2c_read();
delay_us(50);
i2c_stop();
}
/**********SLAVE **********/
#include <16F876.H>
#use I2C(slave,sda=pin_C4,scl=pin_C3,address=0xa0,FORCE_HW)
#INT_SSP
void i2c_slave()
{
ckp=0;
sspbuf=25;or i2c_write(25);
ckp=1;
}
OR any of this int run????????
#INT_SSP
void i2c_slave()
{
if (i2c_poll()==TRUE) ad = i2c_read ();
else i2c_write (25);
}
main()
{
do
{
}
while( 1 );
}
I can see on my scope the start, slave adress 0x0a r/w=1 /ack=0
with 100KHz on SCL.
BUT for the data 24µs appear between eighth SCL and ninth SCL front.
Thank for you help your advice. |
|