View previous topic :: View next topic |
Author |
Message |
PA_papa_wolf
Joined: 11 Nov 2019 Posts: 9
|
I want to read I2C address from an EEPROM. |
Posted: Fri Aug 07, 2020 10:24 am |
|
|
Hi all.
I want to change the I2C address.
The conditions that I need are as follows.
1, I2C address which I decided beforehand
2, I write in EEPROM using I2C address.
3, I2C communicates after this using EEPROM address.
4, I want to enable communication in a thing using standard address if possible when I forget EEPROM address.
Can I do this using a library? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
PA_papa_wolf
Joined: 11 Nov 2019 Posts: 9
|
|
Posted: Sat Aug 08, 2020 12:13 am |
|
|
I'm sorry, it was lacking in explanation.
I want to change I2C address of PIC becoming the I2C slave boldly.
(I thought that therefore I could use a built-in EEPROM)
Is it possible in I2C library?
Can I write it on the cord directly? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sat Aug 08, 2020 12:16 am |
|
|
Yes.
Look at the 12c_slaveaddr function.
Basically setup the I2C slave as normal (using #use I2C), then once you
have read the address you want to use, have the line:
i2c_slaveaddr(I2CSTREAMNAME, newaddr);
This changes the programmed slave address to the new value. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Aug 08, 2020 12:28 am |
|
|
I guess I misunderstood. He wants a PIC to be the i2c slave. |
|
|
PA_papa_wolf
Joined: 11 Nov 2019 Posts: 9
|
|
Posted: Sat Aug 08, 2020 1:41 am |
|
|
Thank you
I obtained the answer that I could be satisfied with. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sat Aug 08, 2020 3:05 am |
|
|
Yes, I didn't understand till he gave his reply to you.
Phrasing the question differently would definitely have helped...
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Sat Aug 08, 2020 4:21 am |
|
|
Actually I'm impressed how anyone can communicate in English ! it's my native language and at 67 STILL having problems with it !!
This forum seems to be the 'United Nations' when it comes to PICs.though here everyone does help out everyone else.
Hmm, seems kinda 'scary' that you can program an I2C device address...as now you'd have to add code to confirm it's still there AND the correct device.. |
|
|
|