Arduino mega2560, TCA9548A (x 2), Oled screens (9+)

I have a problem with my coding for a program that uses 9+ oled screens (128x64) all with the same i2c address (0x3c). Eight of them are connected to one TCA9548A (Mux addr 0x70) and one or more screens to the second TCA9548A (Mux addr 0x71). The 9th screen has a time display running on it (refreshed on each loop) and that works fine, while the other screens display their dynamic info as and when it changes, and that works fine. The problem is that the time display also appears on whichever of the 8 screens on mux 1 last displayed information. Its obvious that even though I select the second mux for the time display, the first mux is still pointing to whichever display it last spoke to. How do I disable whichever mux I’m not actually talking to.

You write zero to the channel select register of the mux you want to disable.

thanks for the quick response.

So each mux has 8 channels which i refer to a 0 thru 7. So wouldn't that mean i was selecting the first oled on that mux?

You may be referring to the channels as 0 to 7, but that's not how the mux chip works. It's channel selection register is 8 bits long and each bit enables one channel. So writing 0b00000001 enables the first channel, 0b00000010 enables the second channel, 0b00000100 enables the third channel and so on. This means you can enable any combination of channels by sending a byte with the corresponding bits set, or you can disable all of them by sending zero.

Maybe you are using some library for the mux chip? Maybe it has a method to set the channel which takes a parameter 0 to 7?

Yep OK got it I understand. Thankyou i'll check it out.

You're welcome. Check out page 17 of the data sheet.

Great all works. If I'd have paid attention to what I read on the adafruit site a week ago I would have had a couple of early nights in the last 2 days. Thanks again.

""======================
To avoid conflict between devices with the same address on different multiplexers, you can disable all channels on a multiplexer with the following code:

Wire.beginTransmission(TCAADDR1);
Wire.write(0); // no channel selected
Wire.endTransmission();