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
/*
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
| _data | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | |
| MM5452 output | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | | |
| values | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | | |
| measured values | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
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.