Problem with MM5450 LED Driver

Hi there,

So this is the first time I'm using a MM5450 chip, the aim being to drive 30+ fans which will inflate some latex gloves (hence the variable names).

I've generated a array of 36 values which consist of alternate ON/OFF pattern to test it but I've failed to make it work :(.

Is anyone able to point in the right direction?

Thanks!

// A function to interface the Arduino to a high I/O count shift-register chip type M5450.
// This takes an array of values and writes the states to the 34 outputs of the M5450 chip.


// What constants are used in this program? (Follow the UPPERCASE convention).
const int NUMBITS = 36; // MM5450 sentence length.

// What is the alias for hardware input and output (I/O) pins used? (Follow the camelCase convention)
// MM5450
int clockPin = 3;
int dataPin = 4;
int dataEnable = 5;




// What are the variables of the system that this program controls? 
int i;
boolean  gloveStates [NUMBITS];
boolean gloveState;

// Bootstrap the hardware (I/O) and initialise the values of system variables and parameters.
void setup() {
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(dataEnable, OUTPUT);

  
  digitalWrite(dataEnable, HIGH); // outputs DISabled.
  // Generate initial off states:
  gloveState = false;
  for (i = 0; i < NUMBITS; i++) {
    gloveStates [i] = gloveState;
  }
  serialMM5450Write(); // Call the function that write the gloveStates to the shift register.
  // when the MM5450 registers are set to zero then release DATA ENABLE
  digitalWrite(dataEnable, LOW); // outputs enabled.

  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);

}

// Start the main program loop:
void loop() {

  // Insert here the code you want to run wherever the sequenced processes are not running:
  alternateTestPattern1();
  serialMM5450Write();
  printState(); // .
  delay(1000);
  alternateTestPattern2();
  serialMM5450Write();
  printState(); // .
  delay(1000);

}

void serialMM5450Write() {
  // nitty gritty of taking the array and writing each element of the array into the registers of the chip

  digitalWrite(clockPin, LOW); // initialise pin state.
  delayMicroseconds(100);
  digitalWrite(dataPin, LOW);
  delayMicroseconds(100);
  digitalWrite(clockPin, HIGH); // clock the data into the register.
  delayMicroseconds(100);
  digitalWrite(clockPin, LOW); // initialise pin state.
  delayMicroseconds(100);
  digitalWrite(dataPin, HIGH);
  delayMicroseconds(100);
  digitalWrite(clockPin, HIGH); // clock the data into the register.
  delayMicroseconds(100);
  digitalWrite(clockPin, LOW); // initialise pin state.
  delayMicroseconds(100);

  for (i = 0; i < 36; i++) {
    // Specify the data state.
    if (gloveStates[i] == true) {
      digitalWrite(dataPin, HIGH);
    } else if (gloveStates[i] == false) {
      digitalWrite(dataPin, LOW);
    }
    delayMicroseconds(100);
    digitalWrite(clockPin, HIGH); // clock the data into the register.
    delayMicroseconds(100);
    digitalWrite(clockPin, LOW); // .
    delayMicroseconds(100);
  }

  return;
}

void printState() {
  for (i = 0; i < NUMBITS; i++) {
    if (gloveStates[i] == true) {
      Serial.print("1 ");
    }      else {
      Serial.print("0 ");
    }
  }
  Serial.println(" ");
}


void alternateTestPattern1() {
  // Generate arbitary test pattern of alternate on/off states:
  gloveState = true;
  for (i = 0; i < NUMBITS; i++) {
    gloveStates[i] = gloveState;
    // toggle gloveState
    if (gloveState == true) {
      gloveState = false;
    } else {
      gloveState = true;
    }
  }
}

/*
 *
 *   gloveStates [0] = true;
  for (i = 1; i < NUMBITS; i++) {
    // toggle gloveState
    if (gloveStates[i - 1] == true) {
      gloveStates[i] == false;
    }
    if (gloveStates[i - 1] == false) {
      gloveStates [i] = true;
    }
  }

 */

void alternateTestPattern2() {
  // Generate arbitary test pattern of alternate on/off states:
  gloveState = false;
  for (i = 0; i < 36; i++) {
    gloveStates [i] = gloveState;
    // toggle gloveState
    if (gloveState == true) {
      gloveState = false;
    }      else {
      gloveState = true;
    }
  }
}

Bump