Pages: [1]   Go Down
Author Topic: How do I give an I2C device an address?  (Read 479 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have my nice shiny new Arduino Mega and a few I2C devices such as a Tiny RTC and a Temp and Humidity sensor.  I have read lots about the I2C interface and I think I understand it with the exception of the device address.  Does one assign a device an address (and if so, how does one do that?) or is the device address hard wired into the device in which case how do I read it?

Many thanks for any help
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 254
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The easiest thing to do is look at the datasheet, this ought to tell you everything you need to know. Some modules have fixed addresses, some have software controlled addresses, some have hardware controlled addresses (where you have a set of pins that determine the address). Datasheets can be very cryptic and it can be a bit of a pain finding what you want, but a search for "address" should help you find what you want.

Tobyb121
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Toby - I guess I just have to dig a little deeper.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could try running this
http://playground.arduino.cc/Main/I2cScanner
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does one assign a device an address

the device manufactuers assign the addresses.

If you code your own slave, you can make it whatever you want.
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
you can make it whatever you want

... as long as it is unique for the I2C implementation on your project. It should be clear that all devices have unique addresses for a specific implementation.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Pages: [1]   Go Up
Jump to: