Max7219 and 4 digit seven segment display

I am trying to learn how to use this chip: http://www.adafruit.com/datasheets/MAX7219.pdf with this display : http://www.taydaelectronics.com/datasheets/A-769.pdf but I’m getting strange output. I’m using the MAX7219 library with this example:

#include <stdio.h> /* for itoa(); */

//Due to a bug in Arduino, this needs to be included here too/first
#include <SPI.h>

#include <MAX7219.h>

const MAX7219_Topology topology[2] = {{MAX7219_MODE_7SEGMENT, 0, 0, 0, 3},
                                      {MAX7219_MODE_NC, 0, 4, 0, 7}};
const char alphabet[17] PROGMEM = "0123456789-EHLP ";
/* we always wait a bit between updates of the display */
const byte delaytime = 250;

MAX7219 maxled;

void setup() {
  maxled.begin(topology, 2);
  maxled.zeroDisplay();
}

/* This will scroll the whole 7-segment font on the display. */
void scrollDigits() {
  char framebuffer[4];
  
  for(byte i = 0; i < 13; i++) {
    for(byte j = 0; j < 4; j++)
      framebuffer[j] = pgm_read_byte(&alphabet[i + j]);
    maxled.set7Segment(framebuffer);
    delay(delaytime);
  }
  maxled.clearDisplay();
  delay(delaytime);
}

/* This will count down from 100 to zero */
void countDown() {
  char buf[5] = "    ";

  for(byte i = 99; i > 0; i--) {
    itoa(i, buf, 10);
    //Show a space (blank digit) instead of a zero
    buf[strlen(buf)] = ' ';
    maxled.set7Segment(buf);
    delay(delaytime);
  }
  maxled.clearDisplay();
  delay(delaytime);
  maxled.set7Segment("----");
  delay(delaytime);  
}

void loop() { 
  scrollDigits();
  countDown();
}

According to the example code I should expect to see scrolling digits followed by a countdown, but what I am seeing is a repetitive sequence of garbled characters; no distinguishable numbers just the same sequence of segments flashing randomly on all four digits. I have double checked all my connections against the datasheets. One thing i did notice is that the 7219 works with common cathode displays and mine is common anode. could this be my problem?
Also, is it possible to choose my ss pin with this library?

One thing i did notice is that the 7219 works with common cathode displays and mine is common anode. could this be my problem?

Yes. Big time problem.

"Also, is it possible to choose my ss pin with this library?" I can't tell from what you've posted. I am not familiar with that library.

You can wire up the LED/MAX7219 backwards and knock up your own segment table to display meaningful numbers. I did this for a common anode display I had just as a test. The MAX7219 is not meant to work this way but if you keep the display dim with a higher IREF resistor value it does work but I don’t know what damage may happen to the MAX7219 chip over time. I have included the test code I knocked up and have hopefully adjusted it to suit your 7 segment pinouts as they are different to mine.

#include <MAX7219.h>
#include <Wire.h>
// DIG Numbers on MAX7219
//     AAAAA
//  2 F  7  B 6
//    F     B
//     GGGGG
//  3 E  1  C 5
//    E     C
//     DDDDD  DP
//       4    0
/*  Common Anode 4 Digit 7 Segment Display To MAX7219 Pin Connections (* = Anode)
      LED     MAX7219
   (D1*)12      22 (SEG DP)
   (D2*) 9      14 (SEG A)
     (D) 2       3 (DIG 4)
     (E) 1       7 (DIG 3)
   (D3*) 8      16 (SEG B)
    (DP) 3       2 (DIG 0)
   (D4*) 6      20 (SEG C)
     (F)10       6 (DIG 2)
     (C) 4      10 (DIG 5)
     (A)11       8 (DIG 7)
     (G) 5      11 (DIG 1)
     (B) 7       5 (DIG 6)
*/
// numTable[] Segment Bits
//       0
//     -----
//  5 |     | 1
//    |  6  |
//     -----
//  4 |     | 2
//    |  3  |
//     -----  o
//            7
const byte numTable[] = {
    B00111111,  // 0
    B00000110,  // 1
    B01011011,  // 2
    B01001111,  // 3
    B01100110,  // 4
    B01101101,  // 5
    B01111101,  // 6
    B00000111,  // 7
    B01111111,  // 8
    B01101111   // 9
};

const int DIN = 12;                                 // DataIn pin (18)
const int CLK = 11;                                 // Clock pin (17)
const int LOAD = 10;                                // Load pin (16)

MAX7219 lc=MAX7219(DIN,CLK,LOAD,1);

void setup() {
    Serial.begin(9600);
    lc.shutdown(0,false);
    /* Set the brightness to default value */
    lc.setIntensity(0,8);
    /* and clear the display */
    lc.clearDisplay(0);
}

void loop() {
    static boolean dp=true;
    
    for (int y=0; y<10; y++){
        for (int x=0; x<8; x++){
            if (dp == true){
                lc.setColumn(0,x,(numTable[y] + 0x80));
            }
            else{
                //lc.setColumn(0,x,numTable[y]);
                lc.setColumn(0,x,numTable[x]);
            }
        }
        delay(100);
    }
    dp = !dp;
}

String dec2binByte(byte myNum){
  int zeros = 8 - String(myNum,BIN).length();
  String myStr;
  for (int i=0; i<zeros; i++) {
    myStr = myStr + "0";
  }
  myStr = myStr + String(myNum,BIN);  
  return myStr;
}

Thanks! Backwards? Meaning segments to digits? can you help with this error generated by the compiler? sketch_jul31a:55: error: no matching function for call to 'MAX7219::MAX7219(const int&, const int&, const int&, int)' C:\Users\sean\Desktop\arduino-1.0.1\libraries\MAX7219/MAX7219.h:123: note: candidates are: MAX7219::MAX7219(byte) C:\Users\sean\Desktop\arduino-1.0.1\libraries\MAX7219/MAX7219.h:112: note: MAX7219::MAX7219(const MAX7219&) sketch_jul31a.cpp: In function 'void setup()': sketch_jul31a:59: error: no matching function for call to 'MAX7219::shutdown(int, int)' C:\Users\sean\Desktop\arduino-1.0.1\libraries\MAX7219/MAX7219.h:160: note: candidates are: void MAX7219::shutdown(byte) sketch_jul31a.cpp: In function 'void loop()': sketch_jul31a:72: error: 'class MAX7219' has no member named 'setColumn' sketch_jul31a:76: error: 'class MAX7219' has no member named 'setColumn'

Oops,

Looks like I happen to use a library by the same name but not by the same functions as your MAX7219 library. Try downloading this library http://arduino.cc/playground/uploads/Main/LedControl.zip found on this page http://arduino.cc/playground/Main/LedControl. You will need to put it in the libraries folder and then change all MAX7219 to LedControl in the project.

Hopefully if you connect your LED to the MAX using the below pinout it should work.

/*  Common Anode 4 Digit 7 Segment Display To MAX7219 Pin Connections (* = Anode)
      LED     MAX7219
   (D1*)12      22 (SEG DP)
   (D2*) 9      14 (SEG A)
     (D) 2       3 (DIG 4)
     (E) 1       7 (DIG 3)
   (D3*) 8      16 (SEG B)
    (DP) 3       2 (DIG 0)
   (D4*) 6      20 (SEG C)
     (F)10       6 (DIG 2)
     (C) 4      10 (DIG 5)
     (A)11       8 (DIG 7)
     (G) 5      11 (DIG 1)
     (B) 7       5 (DIG 6)
*/