How to use SN74LVC4245A?

Hi everybody!
I bought myself a bunch of SN74LVC4245A. This is an octal bus transceiver with integrated 3.3 to 5 V (and vice versa) level shifting capabilities. I want to use them to exchange data between my Arduino Due and my Z80 beadboard CPU. But before that, I just wanted to test the ICs and built a litte test circuit. I connected the 3.3V bus pins to P2-9 of the Due and the 5V bus pins to 8 LEDs (with resistors, of course :slight_smile: ). I've uploaded the followig listing:

int i = 0;

void setup() {
  // put your setup code here, to run once:
for (i=2;i++;i<10)
  {
    pinMode(i,OUTPUT);
    digitalWrite(i, LOW);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
for (i=2;i++;i<10)
  {
    digitalWrite(i,HIGH);
    delay(1000);
    digitalWrite(i, LOW);
  }
}

But it doesn't work. No LED lights up. When i use the following code, at least all LEDs light up as they should, so I guess the ICs themselves are okay:

int i = 0;

void setup() {
  // put your setup code here, to run once:
for (i=2;i++;i<10)
  {
    pinMode(i,OUTPUT);
    digitalWrite(i, HIGH);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
}

So, my question is: why does the SN74LVC4245A doesn't react to logic level changes? I checked that the control lines (DIR and /OE) are both grounded as neccesary. Everything seems to be correct and the basic function also seems to work (all LEDs high or low). But why can't I change the logic level during the main program run?

Greetings,
Markus

for (i=2;i++;i<10)
  {
    digitalWrite(i,HIGH);
    delay(1000);
    digitalWrite(i, LOW);
  }

as soon as you write it low, you immediately (mere microseconds later) write it high.

I connected the 3.3V bus pins to P2-9 of the Due and the 5V bus pins to 8 LEDs (with resistors, of course smiley-kitty

I connected the 3.3V bus pins to P2-9 of the Due

Which pins of the level shifter chip are you referring to in this statement ?

CrossRoads:
as soon as you write it low, you immediately (mere microseconds later) write it high.

Well, but it's a loop. :wink: So, after setting pin i LOW, milliseconds later, pin i+1 goes HIGH. By the way; I've gotten the same results with a while loop:

i = 2;
while (i<10)
  {
    digitalWrite(i,HIGH);
    delay(1000);
    digitalWrite(i, LOW);
  }

raschemmel:
Which pins of the level shifter chip are you referring to in this statement ?

Pins 21 to 14 (B1 to B8). On the other side, pins 3 to 10 (A1 to A8) are connected to the LEDs. The control lines are both grounded, wich means "B data to A bus" which seems correct to me in this case.