Pages: [1]   Go Down
Author Topic: Changing the I2C adress of arduino  (Read 875 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys i am very new to arduino programming but i want change the I2C adress of arduino board.Currently it is 127(0x3F) but i want to make 5 bit adress(0-30). Any idea
Thanks in advance....
Logged

Thanx & Regards

Niladri

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26520
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
.Currently it is 127(0x3F)
sp. "127 (0x7F)"

Do you have any context for this question?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for the reply....
but i could not understand what you mean to say.... but if you run nick gammon scanner program as one arduino master another as slave it always returns 127(0x7F sorry for previous error!!!!) that is 7 bit address but i want to change it to in range of 0-30 but how change it.... Is their any register(for Atmega328 their is register...), if it their how to set it????
Thanks in advance
Niladri....
Logged

Thanx & Regards

Niladri

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26520
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is their any register
You need to look at the TWAR in the processor datasheet.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes i know TWAR register of ATmega328 but how to set it using arduino sketch???? I am very new to it  so any sketch is their which i can use or get a idea????
Thanks in advnace
Niladri....
Logged

Thanx & Regards

Niladri

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26520
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using the Wire library? (which is why I asked for context in reply #1)
You set the address in the "begin" method.

(is there something wrong with your punctuation keys?)
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes i am using Wire library
Sorry i could not make myself clear
I know arduino I2C address is 127 but that is basically the I2C adress of the controller but controller I2C address can be changed by setting TWAR register. So i want to know it their is a funtion or sketch in arduino 1.0 IDE that can give me the access to the TWAR register of Atmega328.
Thanks in advance.
Niladri
 
Logged

Thanx & Regards

Niladri

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26520
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So i want to know it their is a funtion or sketch in arduino 1.0 IDE that can give me the access to the TWAR register of Atmega328.
See reply #5.
You have the source of the Wire library, why not look at it?

When in doubt, there's always the reference
« Last Edit: September 14, 2012, 04:56:22 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok i am going through wire library will get back to the topic after some time
thank you very much
Niladri.
Logged

Thanx & Regards

Niladri

Offline Offline
Newbie
*
Karma: 0
Posts: 39
Well done is better than well said." --Benjamin Franklin
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry bit late to post this but this possible (not 5 bit address scheme).
In Wire.begin() if you don't write anything it will take the default address(i,e 127, 0x7F) but if you give any other address which does not conflict with other device it takes that address(if you send like Wire.begin(0x05) and then run the nick gammon scanner sketch making another arduino as master that the one which has been programmed with 0x05 will give the address 0x05. I have the screen shot i will post it some other time. ) 
Thanks everybody for their valuable input
Regards
Niladri
Logged

Thanx & Regards

Niladri

Pages: [1]   Go Up
Jump to: