Jump to content

Choices for 8x8 led matrix


levon
 Share

Recommended Posts

I'm starting to design a new project, basicaly a 8x8 matrix. But I'm a little confused as to what way to go about it.

I want to have a single coloured 8x8 led matrix and I will be programming in C.

It will have a core, 1 4xDIN module (28 buttons, 2 encoders) 2-4 pots connected directly to j5 of the core. And 1 4xDOUT. For the core I will have 8 red/green leds connected to the first two multiplexers.

For the third and fouth multiplexers I wanted to use as a 8x8 led matrix, using J5 of the DOUT board for the anodes of the matrix, and J6 for the cathodes. I found a diagram on using this for the midibox 64e with led rings.

Now I'm not sure if I should try to used the blm driver, the 64e software, SID or code it myself, as the availlable drivers have features that I don't require, and I don't know asm to customize them.

Are there any C examples of an 8x8 matrix already?

Is C fast enough to do a matrix?

I'm having a bit of trouble getting my head around how the matrix works, but I would basicaly like to be able to control each led in the matrix individualy.

Also, would I be able to control the brightness of the LEDs individualy by flashing them very quicky at different intervals in the led matrix?

Thanks

Link to comment
Share on other sites

This is a C based example, which demonstrates the usage of the assembly based BLM driver for MIOS8:

http://svnmios.midibox.org/listing.php?repname=svn.mios&path=%2Ftrunk%2Fapps%2Fexamples%2Fbutton_duoled_matrix%2F

This C based module (which is only provided for MIOS32, but could also be ported to MIOS) is an example how to handle a 8x8 button/LED matrix:

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fblm8x8%2F

if you remove all functions which are related to button handling, you will get the code for which you asked for (or the other way around: BLM8X8_PrepareCol() is the only relevant function for your usecase)

Is C fast enough to do a matrix?

Definitely yes, as the DOUT register handling itself is handled by MIOS, and it's already speed optimized so that you don't need to take care about the low level stuff. Just hook the code which periodically changes the DOUT values into SRIO_ServicePrepare() - this function is called each mS before MIOS updates the DOUT registers.

Also, would I be able to control the brightness of the LEDs individualy by flashing them very quicky at different intervals in the led matrix?

No, because a really satisfying PWM requires a much higher update frequency - details: see this article:

http://www.midibox.org/forum/index.php/topic,10915.0.html

Meanwhile I developed a simple way to generate PWM, an example code can be found under

http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fbootloader%2Fmain.c

(MIOS32 only, search for PWM)

But it only works if the LED is directly connected to an IO pin. It won't work for LEDs connected to the SRIO chain due to the slower update frequency (1kHz instead of 10 kHz), and it especially won't work for multiplexed LEDs, since it reduces the update frequency (e.g. 8x8 matrix: 125 Hz instead of 1kHz)

Best Regards, Thorsten.

Link to comment
Share on other sites

Thanks TK, you rock.

Ill have a look into the BLM code. since im using just a single led 8x8 matrix, i can do this with just 2 Shift Registers. J5 and J6 of the DINx4 board.

Is there much difference between the Mios32 and MIOS? how much code will need changing?

Looks like ill skip the dimming LEDs, but would it be possible to flash them, say once a second?

Link to comment
Share on other sites

Is there much difference between the Mios32 and MIOS? how much code will need changing?

The code isn't compatible (e.g. due to different function names and different variable types), but the concept is the same for PIC based MIOS.

Looks like ill skip the dimming LEDs, but would it be possible to flash them, say once a second?

Sure - use a 16bit variable (unsigned short) as a counter. Increment it on each SRIO_ServicePrepare() invocation (each mS), and set it back to 0 once it reaches 1000 (== 1 second). Now you could apply an inversion mask to each DOUT bit which should flash whenever the counter is > 500, this gives you a 1:1 flash ratio.

Best Regards, Thorsten.

Link to comment
Share on other sites

Looks like ill skip the dimming LEDs, but would it be possible to flash them, say once a second?
easier : clockbox muxed with BLM(rainbow) can do that

just make a command line like (beats counts 0 1 2 3 then return to zero)

when beats = 0 or 1, then Led ON, else LED off

, default BPM is set to 120

i've started to code this but i do not remember if it is published in the topic

Link to comment
Share on other sites

  • 2 weeks later...

Can the BLM driver be used with the AC-Sim? ive been trying to get it working, with no luck. Also it seems that DOUT_SetPin(); doesnt work with AC-sim.

anyway...

Im building the matrix next week and just wanted to make sure Im doing it right before i start.

The Cathodes of the LEDs will be connected verticaly in colums 1,2,3,4,5,6,7,8. these will be connected to J5 of a DOUT module ( pins 0-7)

The Anodes of the LEDs, will be connected horizontaly in rows 1-8 and connected to J6 of a Dout (pins 0-7)

Im just not sure as http://www.ucapps.de/mbhp/button_duoled_matrix.pdfm has some of the buttons connected to the Dout Cathodes.

If I set it up like that in an 8x8 rather than a 4x16, will the scrambling discribed in this link be a problem, or can it be changed in software?

im fairly sure it will all be fine, but i just wanted to check so im not wasting time.

thanks

Link to comment
Share on other sites

If I set it up like that in an 8x8 rather than a 4x16, will the scrambling discribed in this link be a problem, or can it be changed in software?

if you look at the Rainbow topic i made, you will see a schematic to build your own Matrix. And you look in the last version of the software (v1.8 ), you will see there is a possibility to do 4x16 or 8x8 thanks to an algo developped by bugfight. It is called DESCRAMBLING.
Link to comment
Share on other sites

  • 2 weeks later...
just need to build my 8x8 matrix

i advise you to do a RGB matrix even if you use only 1 colour. It would be ready for future enhancemnts. And i also advise you to get sparkfun kit as it is easy to solder and buttons are good ; LEDs can be found in ebay china for 25 euros/100pcs.(topbright88)Kommon KATHOD

follow the TK's schematic with my pen additions and you are in.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...