Numeric Value

This function block controls the associated HMI object of the type "Numeric Value".

An integer signal of the data type UCHAR, WORD, LONG or LONGLONG or a floating-point signal of the data type FLOAT or DOUBLE is connected to the input Value. Its value is displayed in the HMI object according to the settings in the parameter dialog.

The object is hidden when a LOW signal is connected to the input bShow. The input iLang is used to adapt language specific font and text resources. lFGClr and lBGClr define the foreground and background colors. Palette indexes (0-255) are expected at 8-bit color depth and BGR-values (blue-green-red) at 24-bit color depth. They are provided e.g. by the color parameter block as of library version 7.0.

HMI object

The HMI object displays a numeric value together with an optional unit. Overlong texts are cut off at the edges of the object.

If a font with anti-aliasing is used, in addition to the foreground color, several gradations up to the background color are used to smooth out edges during text output. If the resulting glimmering of the background color interferes when the object is transparent (deactivated background), it is recommended to change the background color or to choose a font without anti-aliasing.

Parameter

The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "Numeric Value" is assigned to the block by creating or selecting it. With the checkbox in the lower left corner you can switch between global and instanceable assignment.

Default settings for the HMI object are made in the corresponding dialog, which appears after "Additional settings …". The font, the display format, the unit, the text alignment and the default values for the colors are defined here. The display formats “automatic”, “compact” and “fixed number of decimal places” can be selected.

At the format “automatic” the integer values are displayed in the normal form with the required number of digits. At this a LONGLONG value can cover up to 19 digits plus a possible sign. The length of the output is limited with the format “compact”. Now the value after “Number of digits” defines the length for the value representation with exponent. The sign of the integer value is not counted during the length calculation. For example, if the number of digits is 6 then the value -123456 is displayed in normal form and -1234567 is represented by -1.235E6. As for the representation with exponent at least 4 places are needed, a smaller number of digits does not affect the value output. Shortened value outputs are rounded. The normal form of the integer value is extended by a decimal point and the necessary number of trailing zeros when the display format “fixed number of decimal places” is selected and the number of digits is greater than 0.

At the format “automatic” the floating-point values with exponents less than 6 and greater than -5 are displayed in normal form. Otherwise, the representation is with exponents. The output text contains only the necessary places. And the mantissa is limited to a maximum of 6 digits. The length of the output text is increased when the exponent is between -1 and -4 because additional zeros have to be added before and after the decimal point. The format “compact” is offered to limit the output text to a fixed length. At this the “Number of digits” defines the maximum for the sum of the numbers of digits before and after the digital point and the length of the exponent. The normal form appears when the value can be displayed with the entered number of digits. At exponents below -4 the output text contains always an exponent. If the number of digits is too small to display a value the output text is enlarged to the minimum necessary length. At format “fixed number of decimal places” the value is always represented without the exponent and with the specified number of digits after the decimal point. Values with more decimal places are rounded and others are complemented with additional trailing zeros.

The unit can be assigned either as a language specific text resource or as a plain text.

Signals

Name I/O Type(s) Function
Value I FLOAT, DOUBLE, UCHAR, WORD, LONG; LONGLONG Value to be displayed
bShow I BIT Show/hide object
iLang I WORD Language resource (ID)
lBGClr I LONG Background color
lFGClr I LONG Text color

Note: If inputs are not connected the object appears with the corresponding default parameters that have been entered in the mask designer. Otherwise the input signal from the function block overwrites the according setting from the parameter dialog.

Visualization

The assignment of the HMI object is displayed in the block by the color of the text boxes. A yellowish background indicates a global assignment. If the assignment is instanceable, the background is white. And at missing or incorrect assignment it is red.