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

Hello. can someone show me about i2c on multimaster mode

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



Joined: 06 Mar 2014
Posts: 1
Location: mexico city

View user's profile Send private message Yahoo Messenger

Hello. can someone show me about i2c on multimaster mode
PostPosted: Thu Mar 06, 2014 3:29 pm     Reply with quote

I'm making a circuit with two pics and one i2c rtc and 24c04.

One pic controls an lcd and a keyboard. The other controls sensors and actuators. This last one reads info from rtc and keeps it in the 24c04, the other only read the memory and display it on lcd, and program the rtc.

How can i do it?
_________________
hi, I'm starting to work with pics, and i need much help
Ttelmah



Joined: 11 Mar 2010
Posts: 19548

View user's profile Send private message

PostPosted: Fri Mar 07, 2014 1:16 am     Reply with quote

Best way, add another wire.

Problem is that true 'multi master' requires all the slave devices to also understand this, and protocols in place to handle bus collisions etc.. Your slave devices do not have this.

So instead, have a single wire with a pull up resistor, connected between the PIC's.
Then a device wanting to 'send', verifies the wire is high. Waits till it is.
Once it is high, pulls it low, and waits a short time.
Then _releases_ it (output_float), and checks that it goes high. If it doesn't, go back to the first test.
If it does go high, pulls it low again, does the I2C transaction, and then releases it.

In each case the wire is either released (output_float), or driven low (output_low). The level is checked using 'input_state'.

Since there is then only one master device on the bus at any time, normal transactions can then be used.

The 'release and check', verifies that the other device has not pulled the wire down at almost the same moment.

I have to say that it'd be easier to program, and likely to be less trouble, to have one device only control the bus, and just send the data with perhaps RS232 to the other.

Best Wishes
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