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 support@ccsinfo.com

I2c Stop bit problem

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



Joined: 28 Jan 2004
Posts: 0
Location: Brasil

View user's profile Send private message Send e-mail

I2c Stop bit problem
PostPosted: Sun Feb 15, 2004 11:30 pm     Reply with quote

Hi My name is Leonardo and I having some problems with I2C Comunication I having a PIC16f876 as Master and a 16F877 as Slave 1
and a 16f876 as Slave 2 When I send a i2c_write to Slave1 the communications are well , but when I send to Slave 1 and then to Slave 2 is like that i2c_stop never occurs keeping the sdi and scl low (or high) indefinelly

Does someone knows or have implemented i2c with 2 or more Slaves?
Al



Joined: 13 Nov 2003
Posts: 28
Location: Belfast

View user's profile Send private message

PostPosted: Mon Feb 16, 2004 3:09 am     Reply with quote

Hi Leonardo,
Before issuing an i2c_stop you need to issue a no-acknowledge with your last communication before the i2c_stop. For example after doing a series of i2c_reads (issuing an 'acknowledge' each time) as follows.

AckBit = 1;// issue an 'acknowledge'
readRegisterValue = i2c_read(AckBit);
readRegisterValue = i2c_read(AckBit);
readRegisterValue = i2c_read(AckBit);


Before issuing the i2c _stop - issue a no-acknowledge

AckBit = 0;// issue no-acknowledge
readRegisterValue = i2c_read(AckBit);

i2c_stop();
_________________
Alan Murray
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