MAX7221 Led driver discussion (again)

With the MAX7221, you use SPI.transfer to write to each register that represents 8 LEDs.

There a couple of registers to write to start up - scan limit (how many digits), intensity (brightness), mode of operation.

// addresses for the MAX7221, and the values/ranges to write in

#define DECODE_MODE 0x09 // write data 0xFF, Code B Decode for all digits
#define INTENSITY_ADDRESS 0x0A // 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
#define SCANLIMIT_ADDRESS 0x0B // 0xFF, all 8 digits on
#define SHUTDOWN_ADDRESS 0x0C // 0x01, normal operation (0x01 = shutdown) - powers up in shutdown mode
#define DISPLAYTEST_ADDRESS 0x0F // 0x01 = all lights on full, 0x00 = normal ops

Do 2 SPI.transfer's with register address and the data you want.

Heres the transfer for one of the 8 display registers.

digitalWrite(SS,LOW); // take the SS pin low to select the chip
SPI.transfer(minutes_tens_address); // select the Address, (I had 8 digits,wrote to them all like this
SPI.transfer(number_to_display); // select the data
digitalWrite(SS,HIGH); // take the SS pin high to de-select the chip

Don't need any library for this.