Bargraph (segmented)

This function block controls a bargraph with two bars in an HMI.

The input bShow is used to show or hide the HMI object. The inputs lPosB1 and lLenB1 are used to define the start vale and length of the first bar. The inputs lPosB1 and lLenB1 are used for the same purpose for the second bar.

With lClrB1 und lClrB2 the colors of the two bars can be set. 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 horizontal or vertical bar graph, depending on the aspect ratio. It is able to draw two bars on top of each other. The two bars are independent of each other. In the HMI this object will depicted by drawing the background first, then the first bar and after that the second bar. When the two bars overlap each other, the second bar is in the foreground. A scale can be shown, too. In case of a horizontal bar the scale is depicted above the bar, otherwise it is depicted left of the bar.


The mask designer is called as the parameter dialog via the context menu of the block. An HMI object of the type "Bargraph (segmented)" 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 …". Here, the display style (with frame, no frame, raised, and recessed) can be selected. The colors of the different elements of the object are configured. This includes a specific color to indicate an overflow. Additionally, the minimum and maximum values are specified. Finally, the features of the scale can be configured.


Name I/O Type(s) Function
bShow I BIT Show/hide object
lPosB1 I LONG Start position bar 1
lLenB1 I LONG Length bar 1
lPosB2 I LONG Start position bar 2
lLenB2 I LONG Length bar 2
lClrB1 I LONG Color of bar 1
lClrB2 I LONG Color of bar 2

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.


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.


The inputs lPosB1 and lLenB1 or lPosB2 and lLenB2 have to be connected or not connected as pairs.