Go Down

Topic: MM5452 LCD Driver (Read 569 times) previous topic - next topic

zsawyer

I have a MM5452 driver chip and am currently trying to get it to work with the arduino.
I used the display() function from the SevenSegment Library on arduinos site.as a starting point.
I have a dataPin, clockPin, and dataEnablePin.  I am testing the first 20 of 32 outputs using bargraph LEDs.

This is how my code goes so far.
Set up a boolean array with 32   1 or 0 values
Set dataEnable HIGH as part of setup()

Start loop()
pulse the Clock HIGH and LOW
drop the dataEnable LOW
for the next 32 cycles
   set the dataPin HIGH/LOW depending on the value of what is in booleanArray
pulseClock another 3 times because the internal load wont trigger until 36 clock cycles.
set dataEnable HIGH

Code: [Select]
/*
Unable to access _data[0] and [1]
*/
boolean _data[32] = {1,0,1,1,0,1,1,1,  //1-8
                     0,1,1,1,1,0,1,1,  //9-16
                     1,1,1,0,1,1,1,1,  //17-24
                     1,1,0,1,1,1,1,1}; //25-32
int _pinData = 2;
int _pinClock = 3;
int _pinEnable = 4;

void setup(){
//  Serial.begin(9600);
  pinMode(_pinClock, OUTPUT);
  pinMode(_pinData, OUTPUT);
  pinMode(_pinEnable, OUTPUT);
  digitalWrite(_pinEnable, HIGH);
//  Serial.println("E");
}

void loop(){
    pulseClock();
    digitalWrite(_pinEnable, LOW);
//    Serial.println("e");

    for (uint8_t i = 0; i < 32; i++){
       digitalWrite(_pinData, _data[i] ? LOW : HIGH );
//    Serial.print(_data[i] ? "d" : "D" );
       pulseClock();
    }
    for (uint8_t i = 0; i < 3;i++){
      pulseClock();
    }
    digitalWrite(_pinEnable, HIGH);
//    Serial.println("E");
}
void pulseClock(){
digitalWrite(_pinClock, HIGH);
//        Serial.print("x");
digitalWrite(_pinClock, LOW);
//        Serial.print("o");     
}

After organizing it i figured out


_data012345678910111213141516171819202122232425262728293031
MM5452 output1234567891011121314151617181920212223242526272829303132
values10110111011110111110111111011111
measured values11011101111011111011111101111111


comparing values to measured values it seems shifted so that _data[0] and _data[1] are never accessed, and _data[30] and _data[31] is HIGH

How can I have the output from the MM5452 chip accurately display the boolean array _data?
Any help would be appreciated.  and Thanks.

zsawyer

Thought I was out of ideas, but I figured it out.
It seems that if I hit the reset function, it would display a segment of the boolean array, so I figured that the problem was the continuous loop.

Also I moved the main clockPulse from the end of the for loop to the beginning.
removing the contents of the loop into a display() function, and only calling the function from a debounced buttonpress makes the arduino function as planned.

So if anyone needs to control 32 LEDs with 3 pins, this might work for a reference.
My application of this may be an led Cube if the timing isnt going to be too wonky.

Any tips on making this faster?

Go Up