RGB LED Matirx problems

So what I am currently working on is the ever popular LMP. I am using a common anode rgb matrix. I am also using four 74hc595 shift registers which are all chained together. What I am trying to do is come up with a few different functions. The first one is to turn on a complete row and be able to stipulate a certain color. The problem I am running into is with green. I can use the function to address each row separately but when I try and use a for loop it skips every other row. I have printed the number that the for loop is feeding in and it seems just fine. But somehow when it gets to the shift register it just sucks. I can address seperatley but not in for loop. Any help would be great. Here is the code.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;




void setup() {
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void all_row(int row, char color)
{
  int row_table[8]={1,2,4,8,16,32,64,128};
  if(color=='r')
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, row_table[row]);
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);  
    shiftOut(dataPin, clockPin, MSBFIRST, 0);
    digitalWrite(latchPin, HIGH);
  }
  if(color=='g')
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, row_table[row]);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);  
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);
    digitalWrite(latchPin, HIGH);
  }
  if(color=='b')
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, row_table[row]);
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);  
    shiftOut(dataPin, clockPin, MSBFIRST, 0xff);
    digitalWrite(latchPin, HIGH);
  } 
} 
void loop() 
{
  for(int j=0;j<8;j++)
  {
    Serial.println(j);
    all_row(j,'g');
    delay(1000);
  }
}

Your code seems pretty much equal for all colors, so I'd suggest checking the connections (hardware) for green.

I assume you have an 8 by 8 RGB matrix from your description, and that the last shiftregister works as row enable for the common anode LED's.

But I'm not sure I follow the problem fully. Does it work with red and blue, even from the for-loop, but not with green? (It doesn't make sense to me if so).

One thing is it could be that row_table[] is an int. I would think the shiftOut worked bytewise.. it could be it's simply typecasted to a byte before shifting out though (or maybe wasting a shiftout of the MSB zero-byte at first?). But this doesn't make sense for just messing up green though.

Could you post a drawing or schematic of your circuit? That might help with finding the problem.

Dan

I ran into a similar problem when trying to mix colours, check the resistance your using for your green channels. Blue and red have naturally lower resistance meaning if switched on at the same time the green fails to light.

You use a common anode RGB Matrix.
Red 2,1V, green and blue 3,2V.

If you use a shiftregister like the 74HC595 for the cathodes you can't fade them.

Good idea to use TLC5940 for the cathodes and a 74HC595 for the anodes !