View previous topic :: View next topic |
Author |
Message |
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
Pic i2c multiple devices |
Posted: Wed May 06, 2015 1:31 pm |
|
|
Hello,
I'm doing a sign that communicate a pic with some peripherals using i2c. But I never used i2c for more than 1 Peripheral.
How can I use?
There is something I need to do or just call all alongside devices using only the SCL and SDA ??
Any tips? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19488
|
|
Posted: Wed May 06, 2015 1:35 pm |
|
|
So long as the devices all have different addresses, you can just talk to each device as if it is alone one the bus.
Remember the bus capacitance will be higher, so you may need to use lower pull-ups. |
|
|
lucasromeiro
Joined: 27 Mar 2010 Posts: 167
|
|
Posted: Wed May 06, 2015 4:26 pm |
|
|
Thanks for the tip!
one of 4.7k pullup would be suitable for 3 devices?
Another question:
One of the devices will be mcp3424, but do not think library, which recommend? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19488
|
|
Posted: Thu May 07, 2015 2:10 am |
|
|
Depends on the length of the bus, and the nature of the tracks used.
You need to estimate the bus capacitance. Pin capacitances for all the chips, capacitances for the tracks. Then with this all summed up, what frequency you are going to run at the fastest, and use the formula/table in the I2C specification, and calculate the pull up required. Go 10% lower than this figure. Provided this then is inside the allowed value for maximum current that all the devices can deliver, you have your figure.
This is down to you writing code. Every 'driver' here and from CCS, is down to a programmer sitting down with the data sheet and just writing the code needed. |
|
|
|