Add a Constant Value to a Function Block Diagram
Constant values are values that remain the same each time the program executes, such as pi, time intervals, fixed text string etc. For example, if a program needs a point to change state after a 2 minute pause, a constant can be used to define the 2 minute time period. Although the time period does decrease from 120 seconds to 0 seconds as the program executes, it is still represented by a constant as the time value is 120 seconds when the program is executed.
To add a constant value to a Function Block Diagram:
- Right-click on the background of the Function Block Diagram.
A context sensitive menu is displayed. - Select the Add Constant option.
The Set Constant window is displayed. - Enter the Constant value. The value needs to include any code characters. For more information, see Built-In Data Types.
- Select the OK button to confirm the entry and close the Set Constant window.
A constant tag is added to the Function Block Diagram. Constant tags are colored blue, and can be connected to other parts of the diagram.
Unlike internal and direct variables, constants can only be of a certain data type. Each constant value has to be one of the Built-In Data Types.