Can't get an 8x8 LED matrix with a MAX7219 chip to work

i've gone through the simple basics with the LED matrix and got it to work with 2 x 74HC595 shift registers.
now i'm "stepping up to the next level" and using the MAX7219 chip.
the sample code from the tutorial doesn't work, which led me to think it was a wiring problem, but after checking the pins again, and even testing a few individualLEDs by connecting a 'row' pin with a 'col' pin, i'm not sure what else to check.

i've pared down the code to it's most simplest form but even that fails, could you please take a look and see if the code at least is valid ?
the result is all the LEDs light up (wow, super bright like i've not seen them before using the 74HC595s !!) except for the last column.

here's the code i'm testing with;

// Code for Project 21 - from "Beginning Arduino 2nd Edition" - by Michael McRoberts)

int DataPin = 2; // Pin 1 on MAX
int LoadPin = 3; // Pin 12 on MAX
int ClockPin = 4; // Pin 13 on MAX

byte buffer[8];

#define DECODE_MODE_REG 0x09
#define INTENSITY_REG 0x0A
#define SCAN_LIMIT_REG 0x0B
#define SHUTDOWN_REG 0x0C

void clearDisplay() {
  for (byte x=0; x<8; x++) {
    buffer[x] = B00000000;
  }
  for (byte row = 0; row < 8; row++) {
    writeData(row+1, buffer[row]);
  }
}


void initMAX7219() {
  pinMode(DataPin, OUTPUT);
  pinMode(LoadPin, OUTPUT);
  pinMode(ClockPin, OUTPUT);
  clearDisplay();
  writeData(SCAN_LIMIT_REG, B00000111); // scan limit set to 0:7
  writeData(DECODE_MODE_REG, B00000000); // decode mode off
  writeData(SHUTDOWN_REG, B00000001); // Set shutdown register to normal operation
  intensity(15); // Values 0 to 15 only (4 bit)
}
void intensity(int intensity) {
  writeData(INTENSITY_REG, intensity); //B0001010 is the Intensity Register
}

// The msb is the row of the matrix     and
// the lsb is the dot pattern for the relevant character.
void writeData(byte msb, byte lsb) {
  digitalWrite(LoadPin, LOW); // set loadpin ready to receive data

// Note: if you're interfacing with a device that's clocked by rising edges, you'll need to make sure that the clock pin is low before the call to shiftOut(), e.g. with a call to digitalWrite(clockPin, LOW). 
//digitalWrite(ClockPin, LOW);
  shiftOut(DataPin, ClockPin, MSBFIRST, (msb));
//digitalWrite(ClockPin, LOW);
  shiftOut(DataPin, ClockPin, MSBFIRST, (lsb));

  digitalWrite(LoadPin, HIGH); // latch the data
}


void setup() {
  initMAX7219();
  Serial.begin(9600);
  // put in here, NOT loop() 
//  clearDisplay();
}

void loop() {
  clearDisplay();
//  scroll(" BEGINNING ARDUINO ", 45);
//  scroll(" HELLO WORLD!!! :) ", 45);
  writeData(8,8);
}

i don't get just one LED on, i get 7 columns, and if i comment that out and just leave the clearDisplay() it's still the same result - something is fundamentally wrong here... i can't see it though.

The chip powers up in shutdown mode so your Cleardisplay function call has to be done at the end of the setup, after you have woken the chip up.

(wow, super bright like i've not seen them before using the 74HC595s !!)

You can control that with the value written to the intensity register, and also the Rset resistor value. What value are you using for the resistor?

I used this piece of code I wrote for adjusting led brightness, with a potentiometer . You can drop that in your loop and good to go.

    int potValue = analogRead(A0);  
    int ledBrightness = potValue/68;
    lc.setIntensity(0,ledBrightness);

or if you prefer a single button and digital control you can try this little script

void ledBrightness()
{
  buttonBright = digitalRead(3);
  if (buttonBright != lastBright)
  {
    if(buttonBright == HIGH)
    {
      brightnessNum++;
    }
  }

  if (brightnessNum > 14)
  {
    brightnessNum = 0; 
  }
  lc.setIntensity(0,brightnessNum); 
}

just put in your loop, good to go

ledBrightness();

sensai:
I used this piece of code I wrote for adjusting led brightness, with a potentiometer . You can drop that in your loop and good to go.

int potValue = analogRead(A0);
int ledBrightness = potValue/68;
**lc.**setIntensity(0,ledBrightness);

heh-heh, not quite sensai - you'll notice i'm not using any libraries !

CrossRoads:

(wow, super bright like i've not seen them before using the 74HC595s !!)

You can control that with the value written to the intensity register, and also the Rset resistor value. What value are you using for the resistor?

the Tutorial suggested 39K, i didn't have one so used the next one up which was 47K

marco_c:
The chip powers up in shutdown mode so your Cleardisplay function call has to be done at the end of the setup, after you have woken the chip up.

you mean like this ?

void setup() {
  initMAX7219();
  Serial.begin(9600);
  // put in here, NOT loop() !
  clearDisplay();
}

void loop() {
//  clearDisplay();
//  scroll(" BEGINNING ARDUINO ", 45);
//  scroll(" HELLO WORLD!!! :) ", 45);
  writeData(8,8);
}

it still doesn't change - i think it's to do with the pin-mapping that the code does.
i have since tried the example from the Playground page and it works :smiley: - except the 'row' is upside down, and the 8th column doesn't work - that seems related to the startup when the whole board lights up except for the last one - will check the connections again later.