Close

Character output on structured 7S-LED displays [solved]

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

thomasThomas 04/13/2017 at 05:060 Comments

Board support code in TG9541/STM8EF has supported boards with 3 or 4 digit LED displays for several months now, and output of text (e.g. numbers) on a LED display is simple.

However, since support for the W1401 was added, there are now devices with "structured" LED displays. With "structured" I mean different color, size, or grouped in rows or columns.

Device
Digits & Groups
W1209 3dig red
W1209WK 3dig red, 3dig blue in 2 rows
W1219 3dig red, 3dig green in 2 rows
W1401 2dig yellow, 2dig red (large), 2dig yellow in 3 columns

As an application programmer I want character output to be simple, and I want the code to look the same no matter if it outputs to the console or to grouped digits of LED displays (that's also important for testing). In the future there might be devices with LCDs, or serial data output, and code should "just work".

The easiest way to achieve that, is to use whitespace as some kind of "output element separator" ("." and ".R" should have the same effect). <CR> can act as "return to first element". Of course, this will make the code more complicated than simply spilling text over to the next digit, no matter where it is, but it will make writing applications a lot easier.

If someone has a different idea how to do it, I'd like to hear about it!

EDIT1: OK, since I didn't hear about it, I implemented a prototype. It works quite well, but an extra state is necessary to handle CR consistently (whitespace or CR should move to the next display group only once).

EDIT2: I tested the feature on boards with 1, 2, and 3 display groups, and updated the W1219 and W1401 docs on GitHub. Output of numbers and character strings on grouped LED displays is now really easy!

Discussions