CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

HELP my i2c slave transmetter don't work right

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nanard_bis



Joined: 07 May 2004
Posts: 1

View user's profile Send private message

HELP my i2c slave transmetter don't work right
PostPosted: Mon Oct 04, 2004 2:56 am     Reply with quote

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 Crying or Very sad 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.
Guest








PostPosted: Mon Oct 04, 2004 6:27 am     Reply with quote

Smile Smile
I find my problem when your read (master read)
the final byte you must be use i2c_read(0); and no i2c_read();
for reset the slave transmission.

by by Very Happy
Guest








PostPosted: Mon Oct 04, 2004 1:18 pm     Reply with quote

your mean "transmitter"
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group