Hey all I'm trying to implement using the max7219 in project and I was wondering if my someone could help me better understand what the three pins on the max do. You have din cs and clock. Right now im just tryign to create a simple function that lights up one led and thats it just so i see how to turn a led on and off.
This device uses SPI, so these are SPI signals. din = MOSI cs = SS clock = SCLK
There is no MISO since the device is write only.
Yeah ive never used spi signals. or i atleast i dont think i havn't. I'm just looking to write a simple turn on led function.
Part is simple to use. There are 5 registers you write to in setup( ) using the format below that tell it brightness, how many columns to use, shutdown/normal mode, decode or no decode mode, and display test mode.
Then in loop( ) you write to 1 of 8 registers with the data to display:
digitalWrite (csPin, LOW); SPI.transfer(address); // 01 to 08 for data registers, 09/0A/0B/0C/0F for the controls above SPI.transfer (data); // digitalWrite (csPin, HIGH);
Works just fine with the default SPI library settings: MSBFIRST, 4 MHz transfer, data/clock mode 00. Don't forget the 0.1uF and 10uF caps as called for in the datasheet.
Many people use the LEDcontrol.h library which does not use the fast SPI interface, but instead bit-bangs the control signals.
So for example for to turn on the first led in the board in Row 1 Collumn one what would I write. Im assuming you would use 01 for the address for the first row. Then for how many columns you would just hit 1 collumn right? What would be the sample code for one led on. Also do i put the code written below word for word in setup. Still a bit confused. I'm sorry for my troubles just learning programming without a teacher being there for me is frustrating.
digitalWrite (csPin, LOW); SPI.transfer(0x01); // 01 to 08 for data registers, 09/0A/0B/0C/0F for the controls above SPI.transfer (0x01); // digitalWrite (csPin, HIGH);
I'm also having problems with the max7219. i've hooked it up with a 5x7 dot matrix. I just hooked up 5 seg pins and 7 dig pins, the rest of the max pins are just not connected. When I program the thing (with the ledcontrol library) all of the leds are on and stay on no matter what code I write. i'm not sure if my capacitors are connected the right way, could this create this problem? or is there another easy explanation for this problem?
I just hooked up 5 seg pins and 7 dig pins, the rest of the max pins are just not connected.
You need 0.1uF, 10uF, on Vcc pin, and a current selection resistor as shown in the datasheet. digit pins are connected to cathodes, and segment pins are connected to anodes?
I switched the anodes and cathodes, stupid. Thanks.
Is there a maximum of matrices that can be chained?
Nope. May need to add some buffering for SCK & SS so signals don't degrade with long wires.
Alright i've got them working. I'm wondering if it's possible to have different intensity within one matrix?
No, not unless your sketch can multiplex the data to be displayed, so a column is switched on/off and gets less on-time than the other columns.
OK too bad. what kind of buffer where you talking about?
You talking about Reply #9? I recently used (need to look it up again! Mind like a sieve today) to buffer the SCK & SS signals to 5 banks of 9 chips. Used a part with very low propagation delay (couple of nS tops) and decent to high (8mA or 24mA) drive capability. Serial out from one board went to serial in on the next board. I want to say 74AC244, but I don't think it was a 20 pin chip. Need to look when I get home.