Go Down

Topic: Changing the I2C adress of arduino (Read 967 times) previous topic - next topic

newbee_2

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....
Thanx & Regards

Niladri

AWOL

Quote
.Currently it is 127(0x3F)

sp. "127 (0x7F)"

Do you have any context for this question?
"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.

newbee_2

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....
Thanx & Regards

Niladri

AWOL

Quote
Is their any register

You need to look at the TWAR in the processor datasheet.
"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.

newbee_2

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....
Thanx & Regards

Niladri

AWOL

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?)
"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.

newbee_2

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
Thanx & Regards

Niladri

AWOL

#7
Sep 14, 2012, 11:51 am Last Edit: Sep 14, 2012, 11:56 am by AWOL Reason: 1
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
"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.

newbee_2

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

Niladri

newbee_2

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
Thanx & Regards

Niladri

Go Up