Micro-KIM Tutorial: Brightness of LED Display

A demo is a program that shows off the abilities of a computer or programmer, sometimes even beyond the limits of an original architectural design. For example, a well-known demo theme on the Commodore 64 consists of rendering sprites in the border, i.e. outside the area originally destined for rendering sprites. This tutorial presents demos that use the LED display beyond its (probable) original purpose: adjusting the brightness of characters or even segments.

As shown in the previous tutorial, a refreshing loop is necessary to show all 6 characters on the LED display. Here, the refreshing rate directly defines the brightness of these characters. Simply looping around yields maximum brightness, while lowering the refresh rate dims the screen. This idea can also be used to adjust the brightness of parts of the LED screen (characters or even individual segments within the characters).

To illustrate this effect, let's modify the program of the previous tutorial (the source code of this and the modified program can be found on my Micro-KIM webpage). To focus on the brightness difference, only 'A's are shown. Also, rather than directly looping around, add a few new instructions right before the jump back.

             ....
             lda #0
             sta sad
             lda #11
             sta sbd
             lda #$f7  ; change to $40 for segment
             sta sad
             ldx #200
bright_delay dex
             bne bright_delay
             
             jmp display_loop

This new code glows up the second character for a while before looping around refreshing all other characters. The result of this change is that the second A on the LED display looks a lot brighter, as illustrated below (the effect looks a bit better on the actual kit than in this picture).

Single bright character (second A)

The same idea can be used to change the brightness of individual segments within characters. Changing the value $f7 into $40 as indicated in the comment above makes the center segment of the second A brighter than the rest of the display, as shown below (again, the effect looks a bit better on the actual kit).


Single bright segment (center segment in second A)

Finally, the idea gives rise to a wide variety of demos that change the brightness of the LED display somehow, such as fading the display in and out, sliding a glow effect over characters or segments, or giving emphasis to parts of the display. Give it a try and post your demo here as a comment. For starters, here is one of my sliding glow demos.

Sliding Glow Effect
That's it for this tutorial. As before, please like, share, or comment if you like this series!

Comments

Popular posts from this blog

Connecting Chess for Android to a Remote Server

Checkers Move Generation

Connecting with the DGT Board