MAX6969 – Bug correction

After my previous article on the MAX6969, I’m investigating the reason of the strange visual artifacts on LEDs when changing data.

After a few investigation on the Latch pin, it appeared that I misunderstood the latch operation. I supposed it was reacting like the clock to a rising edge, while it is in fact using the state of the pin.

In my previous program, the latch() function was performing a HIGH -> LOW -> HIGH which causes latch pin to stay HIGH = transparent outputs modifications. I corrected the code so that the latch() function now performs a LOW -> HIGH -> LOW so that data is transferred to outputs only during latch() function. The /OE trick is not needed anymore in max_write() and was removed.

The new source code is:

int DIN = 13;
int CLK = 12;
int LE  = 11;
int _OE = 10;

void setup() {
  pinMode(DIN, OUTPUT);
  pinMode(CLK, OUTPUT);
  pinMode(LE , OUTPUT);
  pinMode(_OE, OUTPUT);

  digitalWrite(LE , HIGH);
  digitalWrite(_OE, LOW);
}

void clk() {
  digitalWrite(CLK, LOW);
  digitalWrite(CLK, HIGH);
}

void latch() {
  digitalWrite(LE, HIGH);
  digitalWrite(LE, LOW);
}

void max_write(word data) {
  word mask = 0x8000;
  for (char i = 0; i < 16; i++) {
    digitalWrite(DIN, (data & mask) != 0x0000);
    clk();
    mask >>= 1;
  }
  latch();
}

word data = 0x0001;
void loop() {
  max_write(data);
  delay(200);

  data <<= 1;
  if (data == 0x0800) {
    data = 0x0001;
  }
}

 

3 Replies to “MAX6969 – Bug correction”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.