View previous topic :: View next topic |
Author |
Message |
andys
Joined: 23 Oct 2006 Posts: 175
|
master-slave |
Posted: Tue Feb 13, 2007 12:18 pm |
|
|
Is anyone who can give me information for master slave for pic16f ????? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Feb 13, 2007 1:21 pm |
|
|
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
|
master-slave |
Posted: Wed Feb 14, 2007 6:42 am |
|
|
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
|
|
Posted: Thu Feb 15, 2007 9:26 am |
|
|
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.
Ronald |
|
|
andys
Joined: 23 Oct 2006 Posts: 175
|
master-slave |
Posted: Thu Feb 15, 2007 5:08 pm |
|
|
Thanks a lot rnielsen.
Any reply for SPI???? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Feb 15, 2007 5:56 pm |
|
|
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. |
|
|
|