Parola A to Z – Multi Zone Displays

Parola_Controlled_ZoneA very powerful feature of the Parola library is the ability to separate a display into a number of zones. This allows the implementation of sophisticated animations schemes and is a key part of being able to create double height displays.

This post explains what they are, how they are set up, and how to manage them.

What is a Zone?

A Parola display is a sequence of n 8×8 LED modules, numbered from 0 to n-1. A zone is simply a contiguous subset of these modules that is treated as a ‘virtual’ display and has all the characteristics (font, text effect, text string, speed, etc) required to run the Parola animation. The example below has 9 modules and 3 zones – the green Zone 0, blue Zone 1 and purple Zone 2.

Parola_Zone_Display

Zones allow for different animations to be running in separate parts of the LED display. This video shows zoned displays in action.

Managing Zones

The creation of zones is determined by the type of begin() method that is called in the user code. Using the method with no parameters creates the default display with just one (default) zone.

However, using the method with the zone parameter prepares the library to manage the number of required zones. If z zones are specified, each one is referenced by a number from 0 to z-1, with zone 0 as the first zone.

The library must also be told which modules belong to which zone. This is done with the setZone() method. Usually this immediately follows begin(), as in the example below,  but it can be done anytime. Zone boundaries can also be changed dynamically during run time.

For the 9 module example display shown in the figure above, the setup code would look like

P.begin(9);
P.setZone(0, 0, 3);
P.setZone(1, 4, 6);
P.setZone(2, 7, 8);

Animating Zones

Most MD_Parola class methods have variants that operate on the whole display (ie, default single zone) or on a specific zone. An example is displayReset() – without parameters it operates on the whole display; with a zone parameter it is used to reset the specified zone only.

The main difference in managing animations comes in the call to displayAnimate(), usually invoked from the main loop() function. For single zone displays the method returns true when the animation is completed, so the construct shown below will correctly detected the end of the current animation.

if (P.displayAnimate())
{
 // do something with the parameters for the animation then reset it
 P.displayReset();
}

However, in multi zone displays, displayAnimate() will return true if one or more of the zones has completed, so an additional step of calling getZoneStatus() for each zone is needed to determine which zones have completed, as in the the code snippet below.

if (P.displayAnimate())
{
  for (uint8_t i=0; i<MAX_ZONES; i++)
  {
    if (P.getZoneStatus(i))
    {
      // do something with the parameters for the animation then reset it
      P.displayReset(i);
    }
  }
}

Or, to wait until all zones have completed before resetting them all, the following code snippet is used.

if (P.displayAnimate())
{
 boolean bAllDone = true;

 for (uint8_t i=0; i<MAX_ZONES && bAllDone; i++)
   bAllDone = bAllDone && P.getZoneStatus(i);

 if (bAllDone) 
 {
    // do something as all zones have completed
 }
}

A number of examples in the Parola library illustrate various ways that zones can be used and are a good starting point for your own application code.

Advertisements

2 thoughts on “Parola A to Z – Multi Zone Displays

  1. Hi Marco.
    Fantastic library but you already know that.
    Is any way to use MD_MAX72xx.h library for 7 segments displays instead of using LedControl.h library.
    Of course only displaying numbers that can be shifted and using some staff from parola libray.

    Thanks

    Like

    1. Technically the library will work. The font definition would simply be one column (8 segments of the LED) and everything else works. Not sure I would use Parola over this though as there is a lot of overhead that would be unnecessary.

      Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s