Pages: [1]   Go Down
Author Topic: Bug in MAX7219 LED driver example code  (Read 942 times)
0 Members and 1 Guest are viewing this topic.
Brooklyn, NY
Offline Offline
Karma: 0
Posts: 40
View Profile
 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 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.
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

Pages: [1]   Go Up
Jump to: