Go Down

Topic: 8x8 rgb led matrix + 4bit pwm, irq code speed (Read 7213 times) previous topic - next topic

madworm

#30
Oct 28, 2008, 09:45 pm Last Edit: Oct 28, 2008, 10:18 pm by madworm Reason: 1
Which code exactly? matrix_code or matrix_test ?

The first one should produce this, the second one needs a button attached to digital pin 7 and should give you this effect, when the button is pressed.

The arduino's digital pin9 should be connected to all the shift registers at pin13 (output enable, G in the schematic). All the 595's pin10 (master reset, SCL in the schematic) should be connected to +5V.

The ICSP pin1 links to the MISO line. I wonder why this has an effect at all. It is not used in the code.

Also make sure you have good contact at the wires. The data transfer runs at several MHz and I had a lot of fun thinking all was broken, just because of bad contact.

If you have trouble making it work, you can try the ShiftOut tutorial first. It also builds a chain of several 595 shift registers. As soon as that works, you can just switch the code + rewire the output enable line to arduino (wired to +5V in the tutorial).

Got and pictures yet ?
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

sparr

a few possibly relevant pointers from someone else doing LED matrix code for the first time...

Have you considered that you can implement 16 brightness levels with 4 loops instead of 16, if you insert delays of different lengths into each loop?

Be sure you take branch length into account, otherwise some cycles of your loop will execute much faster than others, causing inconsistent brightness.

16 linear steps of voltage-on time does not produce 16 consistent levels of brightness.  You need a logarithmic curve to get a looks-linear response.

madworm

#32
Nov 14, 2008, 02:18 am Last Edit: Nov 14, 2008, 02:18 am by madworm Reason: 1
Well, logarithmic... yes. If you take the human eye as the reference. Maybe I forgot about that as I'm trying to avoid such subjective quantities as "brightness" during my day-job. (W/sr is what I prefer, and only linear detectors of course). I also didn't want to over-complicate things.

I'm not sure if inserting delays would be compatible with the multiplexing. Right now it is certain that every loop takes the same amount of time and the 'framebuffer' data is easily translated into a PWM signal without any hick ups.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

jditmarsAPF

Excellent thread! Gave it a full read-through and ejoyed it. Thanks for posting your code and eagle diagram as well. I may just go an build it. :)

rudster

this post helped me out a lil too thanks

Tom Murphy

Thanks for all the work documenting your efforts. It is very helpful for a newbie

Stas

#36
Dec 17, 2008, 09:46 am Last Edit: Dec 17, 2008, 09:46 am by stas2k Reason: 1
Thank you for documenting all your efforts. Did you try to drive more than one matrix at the same time? I just bought 4 of these on ebay and i want to display some mario and other old-school sprites on it. :) Sparkfun's backpack contains a full Atmega but i think it's overkill.

madworm

I did not try driving more than one of these babies with a single micro. In principal it is possible, but it is likely to interfere with the pulse width modulation for the color mixing. I know that the interrupt timing is easily messed up when trying to do more colors, as this takes more time. Adding more matrices should have the same effect. You'll need to adjust the irq timer settings.

Color mixing without PWM will work for sure, but at the cost of fewer colors. Just like the sparkfun gadget does it.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Stas

I'll try to make it work. Yesterday bought 12 74hc595 chips and some current sinks. I'll try to make a simple game. Maybe like frogger, controlled by sega genesis joystick. Did you try some ASM optimizations like loop unwinding?

Go Up