Open-source BASIC code for LED matrix displays

Open-source BASIC code for LED matrix displays

Postby Janke » Wed Mar 15, 2017 3:59 pm

Friends -

Now it works! The package of ten 8x8 LED matrices arrived yesterday! ( At the exorbitant price of $1.30 each... including postage! :D )

If you want to build something similar to this, there are a few pitfalls:

First of all, the EzSBC1 has 3.3 volt logic levels, while the ubiquitous MAX7219 LED drivers need 5 volt logic levels. Therefore, you need a level converter. I simply used a 74ACT04 hex inverter/buffer (two inverters in series for each of the three signals - clock, data and load). The 74ACT04 IC is powered from the same 5 volt supply as the LED drivers, but it will accept the lower input levels from the EzSBC1, and still output TTL/CMOS compatible levels. Note: Must be ACT type, ordinary 7400 TTL or 4000 CMOS series won't work!

You will need a hefty 5 volt supply - USB power isn't enough! I use a 2 amp wall wart.

You may have to use series resistances (1 to 10 K) between the buffers and the display inputs in order to minimize reflections and ripple - check with a scope! Low or high brightness causes less ripple than mid-range. Too much ripple, and you get garbage on the display... A few extra caps (one 100 nF and another 100-470 uF per module) will lessen the ripple.

As designed, the modules shift vertically, and for my purpose, I need horizontal. Thus, the modules had to be turned 90° clockwise, i.e. inputs at top left. I had to connect them with diagonal wires...

Download the MAX7219 datasheet from the web, too, to better understand the intricacies of the data shifting process!

The commented code below should be self-explanatory; I'm shifting out all the data for an 8x80 display one 8-LED column at a time in about 0.7 seconds, like on a teletypewriter, which looks quite nice.

There certainly is a faster way, just 65 ms for refreshing the entire display of 10 modules. I'm sure you can figure it out! Hint: Restructure the SHIFTOUT loops to avoid the NOPs. :idea:

Note that in BASIC, it will not be possible to scroll a large display very quickly, you would need to refresh it at least 40 Hz to get a decent scrolling speed. The absolute maximum for 10 modules with ControlBASIC looks to be around 16 Hz. That's quite snail-paced scrolling! Also, i if you want to do proper scrolling, you'll have to connect the displays for vertical shifting, complicating the code a bit.

I decided not to do it, since my display will eventually consist of 30 modules, and any scrolling would then be at a glacial 5 Hz or so... But if you plan on using only 5 modules or so, then it would certainly be possible!

Good luck, if you plan to build a project like this yourself !

(5.42 KiB) Downloaded 176 times
Hello World.jpg
Last edited by Janke on Fri Mar 17, 2017 11:46 am, edited 1 time in total.
Posts: 29
Joined: Mon Feb 20, 2017 2:48 pm

A few thoughts about smooth scrolling

Postby Janke » Thu Mar 16, 2017 5:20 pm

Commercial LED displays shift in the data by row (contrary to by column in my test above) in order to ensure smooth scrolling. You can tell from the slightly slanted characters, which straighten up as the scrolling stops.

However, this complicates the data handling quite a bit; you either need to shift bits across byte borders, or pre-build eight sets of already shifted data, which can then quickly be sent to the display.

The first alternative is computationally intensive, and will slow down the scrolling considerably, while the other alternative will use up a lot of variable RAM.

Blanking the display during the full-display shifting will cause severe flicker (I tried), so that won't work, either.

However, a display consisting of only 3 modules can be scrolled at a reasonable speed without visible glitches, by inserting a 40ms wait time after each SHIFTOUT of all the 8x24 data. The human eye won't notice the very short glitches.

Both speed and memory are limited with the EzSBC1 (especially if I build a larger font), so does anybody have any good ideas of how to accomplish smooth scrolling on a larger display?
EDIT: Apparently not possible, 3 or possibly 4 modules is about the limit.

ANOTHER EDIT: It is possible to scroll 6 or even 8 modules smoothly, by connecting the modules in an unorthodox way - see my later posts!
Posts: 29
Joined: Mon Feb 20, 2017 2:48 pm

Return to EzSBC1

Who is online

Users browsing this forum: No registered users and 2 guests