Function will not change input

Hi
This code makes me insane:

  void loop()                     // run over and over again
{
  
  for(x=200; x>0; x--)
  {
  udData(sqA, La0);
  udData(sqA, La1);
  }
  
  for(x=200; x>0; x--)
  {
  udData(sqB, La1);
  udData(sqB, La2);
  }
  
  for(x=200; x>0; x--)
  {
  udData(sqC, La2);
  udData(sqC, La3);
  }

}

  void udData (unsigned int data, int layer)
  {
  if(data>255)
  {
    shiftOut(dataPin, clockPin, LSBFIRST, data);
    shiftOut(dataPin, clockPin, LSBFIRST, (data >> 8));
    }
  else
  {
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, data);
  }
  digitalWrite(latchPin, HIGH);

  digitalWrite(layer, LOW);
  delay(1);
  digitalWrite(layer, HIGH);
}

When finished with the first for loop shifting out 'sqA' it doesn't throw away the value of 'sqA'.
Instead of sending the new value of 'sqB' to udData() it still uses 'sqA' for output.
This gives me 3 for-loops with the same data-value but different 'layer'-value.
Anyone knows a solution?
hope to get an answer.

Where are sqA, sqB, and sqC defined/set to a value?

Please post that code as well.

!c

Hey
The sqA, sqB, sqC is unsigned integer values to be sent out on the 76xx595 shiftregister.
Thinking of this made me realize that I have forgotten all about the latch input.
Shifting this LOW only once in the setup code doesn't made the second value get to the shiftregisters parallel outputs.

Sorry to bother you all.
thanks anyway