The way I read the datasheet, if you set A5 permanently low, and A4 permanently high, then the base address will be 0x50, you can then set A3-A0 by DIP or rotary switch to create 16 devices (with addresses 0x50 to 0x5F).
Something to understand to avoid confusion is that the "Fig 4 SlaveAddress" (and probably other parts of the data sheet) is showing an 8-bit i2c address, where bit 0 is the read/write control bit. But in Arduino world, we ignore that bit (it is taken care of behind the scenes by the Wire library) and use 7-bit addresses.
Quick question regarding multiple detection of the same address...
I have put (rightly or wrongly) an ATtiny85 on my slave boards that does nothing but broadcast a reference address so that the main CPU can identify what modules are attached at boot.
Now I understand I could achieve the same thing simply reading all the addresses on the second i2c bus and working out what was attached.
But, my thinking (which I now think is flawed), was that I only wanted the main module talking to modules it had identified at boot. Anything added to the i2x bus after the boot point would be ignored, as the main code would not have initialised it.
My problem.
The slave modules have a single address on an i2c 'ID bus'. This but does nothing but identify modules at boot.
So say 5x MCP23017 multiplexers all have the id address of say 0x20. Yes.... not great.
But those identified modules then have a separate i2c bus for data comms which is selectable with the rotary switch above.
This means that you might have 5x modules with different comms addresses, but the id address is always going to be the same (because there is only one id address for each type of module).
What happens when the i2c bus detects the 5x same id addresses? Will it freeze?
I really don't want to have to implement 2x sets of rotary address switches for both the id and the comms.
Maybe.... I just bin the id system, but I kinda liked it.
Good question, I am not sure. I suspect you get corrupted data as two slaves try to reply. I2C lacks a CRC, so it is difficult to tell when errors occur.
With I2C either use an I2C multiplexer or a custom multiplexing scheme, e.g. selectively disable the SDA on certain slaves.
Identifying addresses in a broadcast bus is of course an age old problem. Generally the solution is to avoid the need and use preconfigured addresses, or use a "side door" with a different topology. A daisy-chain or selective address topology makes it possible. So either daisy chain the ID bus, or use an address select pin (like SPI).
For a multi-drop RS232 network I did, I daisy-chain a "CONFIG" line, which allows the master to discover and configure devices in the chain.