CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I want to read I2C address from an EEPROM.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PA_papa_wolf



Joined: 11 Nov 2019
Posts: 9

View user's profile Send private message

I want to read I2C address from an EEPROM.
PostPosted: Fri Aug 07, 2020 10:24 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 07, 2020 11:55 am     Reply with quote

You can not change the i2c slave address of a normal eeprom such as a
24LC256 by sending it commands. This requires a special type of eeprom.

This eeprom from Microchip has a changeable i2c slave address:
https://www.microchip.com/wwwproducts/en/24CW1280

Here is a recent thread on the topic:
http://www.ccsinfo.com/forum/viewtopic.php?t=58897
PA_papa_wolf



Joined: 11 Nov 2019
Posts: 9

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 12:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 12:16 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 12:28 am     Reply with quote

I guess I misunderstood. He wants a PIC to be the i2c slave.
PA_papa_wolf



Joined: 11 Nov 2019
Posts: 9

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 1:41 am     Reply with quote

Thank you

I obtained the answer that I could be satisfied with.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 3:05 am     Reply with quote

Yes, I didn't understand till he gave his reply to you.
Phrasing the question differently would definitely have helped... Smile

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 08, 2020 4:21 am     Reply with quote

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..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group