Wirte cycles for I2C address register

Hello everyone,

I'm trying to use Arduino Mega 2560 as a multiple slave device. Tried to use the mask register TWAMR in order to reply to different addresses but by doing so I lose the ability to know to which device I'm replying for.

I do have a way of doing what I need but it involves changing I2C address many times per second.

The function

Wire.begin(uint8_t address)

Is realized by setting the register of Arduino my question is:

  • the I2C register what type of memory is it?How many write cycles does it have? Is it like RAM quite "unlimited" or like flash the usual 100k ?

Tried to read the datasheet but wasn't able to find this specific info.

Many thanks,

It's an ordinary register, not persistent.

Why do you want to respond to multiple addresses?

You cannot know the address of the I2C master, a master does not normally have an I2C address.

hi DrDiettrich,

Thank you for the reply. So writing multiple times per second (e.g. 100 times per second ) won't ruin the Arduino after few days

I explained my self in the wrong way about the what I need to do.

My objective is to act as 5 different i2c devices and reply accordingly.

Reply messages are different for each I2C slave address and unfortunately the master doesn't poll in the same sequential way, I cannot change what the master does and I haven't got much time to find out if there is any logic behind the polling order of those 5 I2C devices.

Thank you!

It may help to add a shift register to catch the last address used.

Unfortunately I've also run out of pins to use and knowing the previous used address doesn't solve the trick.

To understand better the datasheet, registers like TWAR, TWAMR, SREG etc... are all part of the "32x8 General purpose registers" (red circle in the photo below), right?

are all special purpose registers.

Even better for me than, this might definitely solve my issue!

Many thanks DrDiettrich!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.