Nevron Open Vision Documentation
Instrumentation / LED Display / Numeric LED Display
In This Topic
    Numeric LED Display
    In This Topic

    The numeric LED displays in NOV emulate the appearance of displays that appear in electronic equipment. It can be used to display numbers in "electronic" fashion.

    Each display consists of cells, which in turn consist of one or more segments that are layout depending on the cell type. The number of segments in a cell cannot change, however the number of cells in a display can.

     Creating a Numeric LED Display

    In order to create a numeric LED display you need to create an instance of the NNumericLedDisplay class:

    C#
    Copy Code

    NNumericLedDisplay numericLedDisplay = new NNumericLedDisplay();

     Display Style

    The numeric display panel can display numeric data in several styles which are grouped by the type of the display cells:

    • 7 Segment Display Cell
    • 14 Segment Display Cell
    • 5x7 Segment Matrix Display Cell

    You change the display style by modifying the DisplayStyle property of the panel. For example:

    C#
    Copy Code

    numericLedDisplay.DisplayStyle = ENDisplayStyle.SevenSegmentRounded;

    numericLedDisplay.Value = 123456789.00;

    The following table summarizes the appearance you can expect for each value from the ENDisplayStyle enumeration:

    Display Style Appearance
    SevenSegmentNormal
    SevenSegmentRectangular
    SevenSegmentRounded
    FourteenSegmentNormal
    FourteenSegmentRectangular
    FourteenSegmentInset
    MatrixRectangle
    MatrixCircle
     Decimal Formatting and Cell Size

    By default the numeric display panel will use a formatting that allows for double digit decimal precision and will automatically adjust the number of cells in the display so that it can display the specified number.

    The numeric display panel has a property called EnableDecimalFormatting that allows you to enable/disable decimal specific formatting. In the screen shots above decimal formatting is enabled (which is the default) and the cell size for the decimal digits is modified to be smaller than the cell size of the major digits (by default the cell size is 20pt x 40pt). The following code will replicate the configuration of the SevenSegmentNormal style display shown above:

    C#
    Copy Code
    numericLedDisplay.DisplayStyle = ENDisplayStyle.SevenSegmentNormal;
    numericLedDisplay.DecimalCellSize = new NSize(15, 30);
    numericLedDisplay.Value = 123456789.00;
     Cell Appearance

    In order to display a character (or other value) each cell can lit some of its segments. The lit and dim fill applied to a cell are controlled through a set of properties exposed by the numeric display panel. The following code will change the lit and dim fill of cells used to display the integral portion of the value:

    C#
    Copy Code
    numericLedDisplay.LitFill = new NColorFill(NColor.DarkRed);
    numericLedDisplay.DimFill = new NColorFill(NColor.FromColor(NColor.DarkRed, 0.2f));
     Cell Count

    The numeric display panel has a property called CellCountMode which allows you to configure whether the display will adjust the number of cells depending on the value being displayed or will contain a fixed number of cells.

    By default the value of this property is set to ENDisplayCellCountMode.Auto meaning that the display will automatically adjust the number of cells. In certain cases however you may wish that the display contains a fixed number of cells. The following code fixes the number of cells to 7:

    C#
    Copy Code
    numericLedDisplay.Value = 123456789.00;
    numericLedDisplay.CellCountMode = ENDisplayCellCountMode.Fixed;
    numericLedDisplay.CellCount = 7;
     Display Direction

    By default the display will show the value with right to left alignment. You can change that by using the DisplayDirection property. For example:

    C#
    Copy Code
    numericLedDisplay.DisplayDirection = ENDisplayDirection.LeftToRight;
     Cell Alignment

    When you use decimal formatting (e.g. when the decimal portion of the value is displayed with a different fill and cell size) you can also take advantage of the CellAlignment property allowing you to control how cells are aligned relative to each other. By default this property is set to ENVerticalAlignment.Bottom, meaning that the cells will be aligned at their bottom edge. You can choose between Top, Center and Bottom. The following code snippet shows how to align the cells on the top:

    C#
    Copy Code
    numericLedDisplay.Value = 123456789.00;
    numericLedDisplay.DecimalCellSize = new NSize(15, 30);
    numericLedDisplay.ShowDecimalSeparator = false;
    numericLedDisplay.CellAlignment = ENVerticalAlignment.Top;

    For aesthetic reasons you may decide to hide the decimal separator when you change the cell alignment. The above code will result in the following image displayed by the panel:

     

     Sign Mode

    The sign mode property of the numeric display allows you to specify when it must show a leading sign (+ or -) depending on the displayed value. The following options are available:

    Sign Mode Description
    Never The numeric display will not show sign information.
    Always The numeric display will always show the sign in from of the numeric display.
    Negative The numeric display will only show a negative sign when the value is negative.

    This property also relates to the ShowLeadingZeros property. When the cell count mode is fixed you can optionally tell the display to fill the remaining cell positions with zero values. The following code shows how to configure a numeric display to display sign informaiton:

    C#
    Copy Code
    numericLedDisplay.SignMode = ENDisplaySignMode.Always;
    numericLedDisplay.ShowLeadingZeros = true;
    numericLedDisplay.CellCountMode = ENDisplayCellCountMode.Fixed;
    numericLedDisplay.CellCount = 6;