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

master-slave

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



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

master-slave
PostPosted: Tue Feb 13, 2007 12:18 pm     Reply with quote

Is anyone who can give me information for master slave for pic16f ?????
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Feb 13, 2007 1:21 pm     Reply with quote

What protocol do you want to use? I2C, SPI, other?
How many slaves are to be connected to your master?
Any special requirements like speed and/or distance?

The more information you can provide the better answers you will get.
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

master-slave
PostPosted: Wed Feb 14, 2007 6:42 am     Reply with quote

This is the first time that i want to use master-slave so i don't know what is diferent between I2C,SPI.I want to connect 1 or two slaves.Do you have any papers or any tutorial to read ????
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Feb 15, 2007 9:26 am     Reply with quote

Do a search for I2C in this forum. That will get you several postings to read.
Go to http://www.nxp.com/acrobat/applicationnotes/AN10216_1.pdf and read the I2C manual.
Download a spec. sheet for an I2C part, good ones are eeproms.
Study all you can and then start to experiment with some parts.
Oscilloscopes, printf statements to a comm port to help debugging and printing to LCD screens helps a lot to figure out what's going on.
Once you have tried and failed, tried and failed..... come post what you have tried and ask for help. The best teacher is 'hands on' and FRUSTRATION of things not working. You'll remember how to do things better that way. Twisted Evil

Ronald
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

master-slave
PostPosted: Thu Feb 15, 2007 5:08 pm     Reply with quote

Thanks a lot rnielsen.
Any reply for SPI????
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 15, 2007 5:15 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=26888&highlight=spi+slave+example
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Feb 15, 2007 5:56 pm     Reply with quote

SPI and I2C are used for communications on short distances between chips on the same PCB, maximum total wire length about 1 to 2 meters.

SPI: uses 3 wires + 1 chip select for each slave (+ gnd).
I2C: uses 2 signal wires + gnd, independent on the number of devices. Multiple masters are possible.
SPI is faster than I2C, has less protocol overhead and is easier to implement but has the disadvantage of the increasing number of signal lines when the number of slaves gets higher. Practically: for 1-to-1 communications I would go for SPI, for 4 or more slaves go for I2C. In between it's up to your preferences.

The Dallas 1-wire protocol is similar to I2C but uses only 1 signal wire + gnd.

Check Wikipedia for more info: SPI, I2C, 1-wire

For communications over longer distances than 2 meter there are many other protocols like ethernet, RS-232, RS-422, RS-485, BSC, CAN, LIN, HDLC, etc.
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