Pages: [1]   Go Down
Author Topic: Bug in MAX7219 LED driver example code  (Read 940 times)
0 Members and 1 Guest are viewing this topic.
Brooklyn, NY
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, the code in the built-in example file (examples/leds/led_drivers/max7219_v1) and the playground file http://www.arduino.cc/playground/LEDMatrix/Max7219 have bugs in them.  As it so happens, the code will still work with a 7219 but not with an identical, fully SPI-compatible chip like the 7221.  

In the max7219_put function, the load line should be set LOW to begin, not HIGH.  this is not strictly necessary for the 7219, only the 7221.  But it is technically wrong regardless.
Code:
void max7219_put(byte reg, byte data)
{
  max7219_setLoad(LOW);  // begin    ** in the example this is HIGH, which is wrong! **
  max7219_putByte(reg);  // specify register
  max7219_putByte(data); // put data
  max7219_setLoad(LOW);  // latch in data
  max7219_setLoad(HIGH); // end
}
Logged

Pages: [1]   Go Up
Jump to: