Well Thats Cool
(Warning, techno-babble)
Working on Heek, I’ve been using the I2C protocol a lot. This has been intentional because I like the way it works. 7 bit address space, only two data wires, etc. But to set a 7 bit address in full would require 7 extra pins in the usual method, so all the different ways that are used to avoid this are quite interesting.
The simplest I’ve seen is to just hard-code the address on the chip, and then sell a few different versions who each have a different address. This is the way the Max6959 I use to control the display for Heek does it; they sell an ‘A’ and a ‘B’ that just have different addresses.
Then, there’s the way the vast majority seem to do it. You get two or three address pins on the IC, and you either pull them to ground or logic-high. These pins correspond to, generally, the least significant bits of the address, and the chips have the rest hard coded. The I/O expanders I use are like this, where the address always starts with 0100, and then you set the last three. I think this is a good way. You get a range of addresses to have several of the chip on the bus, but don’t need a ton of pins.
Then, you get to a strange one involving voltage. Here, there’s a single address pin and the voltage on that pin, relative to VCC, controls the address of the chip. I’m not a fan of this one because it seems a little risky to me. The voltage could be a little off, or something and it would be very hard to figure out what was going on and what address to talk to.
Finally, I just saw this one yesterday on a chip from Maxim while looking into LED matrix display controllers. Similar to the second option above, you have two address pins. In that method, this allows you to have 4 of the same chip on the bus (2^4 = 4). However, this method adds a new twist. You can tie the pins to high, low, or either of the I2C lines (SDA and SCL). Somehow, it internally figures out how they are tied and uses that to figure out an address. This gives you 16 addresses for two address pins! I quite like this method, to tell ya the truth. I mean, I don’t exactly have a project that needs 16 LED display drivers, but still…
So yeah, techno-babble all the way. :D
-K