slowing down wire.h? [solved... and it was hardware related, not programming!]

[edit]As I am looking for a coding fix and not a hardware fix, I think? this is the right forum.
[edit2] This was SOLVED through use of a SPDT relay instead of the AND gates. I posted a schematic below in case others were interested.

Here is the situation,

I am running 10 LED 4x7 segment displays, specifically these: http://www.adafruit.com/products/878. Of course, I have run out of addresses so I thought to split them into two groups controlled by an sn54hc08 (2 AND gate IC). I would send a HIGH signal to one group, send data to those 5, then set the LOW signal. Then I send the HIGH signal to the second group and send the other data. I can see the HIGH signal on a voltmeter to the gates. I can see the HIGH signal from the gates but I suspect the clock is too fast and/or out of sync with the data since it is going through the IC first. For giggles I tried running the clock through the IC as well but this did not work.

The below code works with 5 displays without the IC as I can insert a delay between the tophalf/bottomhalf lines and see the displays run through both iterations. As soon as I put the IC into place, the displays become unresponsive.

the relevant code is:

#include <Wire.h>
Adafruit_7segment matrix = Adafruit_7segment();
Adafruit_7segment matrix2 = Adafruit_7segment();
Adafruit_7segment matrix3 = Adafruit_7segment();
Adafruit_7segment matrix4 = Adafruit_7segment();
Adafruit_7segment matrix5 = Adafruit_7segment();

int tophalf = 14;
int bottomhalf = 16;
int total=0;

void setup() {
#ifndef __AVR_ATtiny85__
  Serial.begin(9600);
#endif
  matrix.begin(0x70);
  matrix2.begin(0x71);
  matrix3.begin(0x72);
  matrix4.begin(0x73);
  matrix5.begin(0x74);
  pinMode(tophalf, OUTPUT);
  pinMode(bottomhalf, OUTPUT);
}

void loop() {

//insert a lot of control and inputs and whatnot 
//total is an int to be displayed 
total = 5;

         digitalWrite(tophalf, HIGH);
         delay(50);
         matrix5.println(total);
         matrix5.writeDisplay();
         delay(50);
         matrix4.println(total * 2);
         matrix4.writeDisplay();
         delay(50);
         matrix3.println(total * 3);
         matrix3.writeDisplay();
         delay(50);
         matrix2.println(total*4);
         matrix2.writeDisplay();
         delay(50);
         matrix.println(total*5);
         matrix.writeDisplay();
         delay(50);
         digitalWrite(tophalf, LOW);
         digitalWrite(bottomhalf, HIGH);
         delay(50);
         matrix5.println(total*6);
         matrix5.writeDisplay();
         delay(50);
         matrix4.println(total * 7);
         matrix4.writeDisplay();
         delay(50);
         matrix3.println(total * 8);
         matrix3.writeDisplay();
         delay(50);
         matrix2.println(total*9);
         matrix2.writeDisplay();
         delay(50);
         matrix.println(total*10);
         matrix.writeDisplay();
         delay(50);
         digitalWrite(bottomhalf, LOW);

}

Very first an oscope is gonna be really handy here :)

Second i don't see a software fix because I2C is a 2 way system and i don't believe it will work through a logic ic because the return data wont make it back. It is kinda interesting subject and if i had to tackle it i would probably use another arduino for part of them and connect them together on another protocol. But you may be able to try an audio switch ic they are designed to switch the ac line of audio so they just may work.

Just googled

"arduino i2c speed"

found

http://forum.arduino.cc/index.php/topic,16793.0.html

According to one of the responses the speed is set by the master

Of course speed may not actually be the issue.

Okay, I tried slowing it down. No go. So I guess since I killed the 2 way communication it is just not going to work.

BUT, I had a SPDT relay lying around. Solved the problem perfectly. I could probably also use two transistors instead, but right now I got it down to one additional pin (instead of 2) to split the signals. I do have to go through initialization twice but after that, it is just a matter of controlling each bank.

Thanks for the help and the clue that it is 2 way. Sadly I purchased the IC's thinking that would solve it when I have relays and transistors on hand! Oh well.

I've not tried this but what about using

http://playground.arduino.cc/Main/SoftwareI2CLibrary on another set of pins

I2C is normally SLOW. 100 kHz or 400 kHz is NOTHING.

What you need is not AND gates, but a bus multiplexer. Unfortunately, none of the one's I've found through cursory searching are in prototype-friendly DIP packages, they're SMD only.

You might be able to make a workable bus switcher with a 2 channel analog multiplexer like a 74HC4052. Use one channel for SCL, and the other to switch SDA.

Unlike logic gates, analog multiplexers are bidirectional and just might work.

Can you draw a schematic of your wiring please, it is hard to see where you are going wrong without. You can do this sort of thing with a logic gate if you wire it correctly.

Here is a general schematic on how it was solved. Send data normally with Pin 14 LOW and you control the left bank of devices. Make Pin 14 HIGH and then send data and you control the right bank of devices. Worked like a charm. Thanks again for the help.