Creating and using a global-object

How to create a global-object:

  1. Select a folder in the project in which you want to create the global-object.
    In the application navigator: The best practice is to create new global-objects below Global variables so that the global variables are created in the subfolder globals of the project and the global variables in these global objects are displayed in a structured way.

  2. In menu File or from the context menu of the folder, select New and the command Global-Object.

  3. In the dialog, enter a name under File Name.
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg If possible, do not enter invalid characters (e.g. umlauts, blanks, the character –, numbers at the start) because the file name is automatically used as global-object-name and this name must be a valid →IEC-identifier. But if you need such invalid characters in the file name, delete or replace the invalid characters in Global-Object-Name before you click Finish.
    It is possible to change the global-object-name at any time later.

  4. Afterwards click Finish.
    Result::

    1. The global-object (with icon images/download/thumbnails/409862651/IconGlobal-version-1-modificationdate-1531214458366-api-v22.png ) is displayed in the views with projects and resources.

    2. The global-object is opened in the →graphical editor.

  5. Create or edit the content, e.g. the →global variables. Details: See"Actions within the global-variables-editor".

  6. In order to use the global variables within the application, assign the global-object to an ST-→program or a →resource oder →configuration. Best practice is to drag the global-object within the application navigator onto the corresponding object:

    1. Make the application navigator visible.

    2. Point to the global-object that is displayed below the folder Global variables (or a subfolder of it).

    3. Press and hold the primary mouse button and drag the global-object onto the program type ( usually displayed below the folder Project blocks ) or onto the resource or configuratin that is displayed within the application navigator .

    4. Release the primary mouse button.
      Result: The
      ST-program or the PLC-object (containing the resource or configuration) is enhanced by the necessary reference. This reference is an INCLUDE_GLOBALS directive (see "Declaration of global variables in global-object and its usage in ST", if you need more information on this directive) . If you assigned the global-object to a resource or configuration, this global-object is also displayed in the folder Configuration-Global Variables or Resource-Global Variables.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg In order to unassign the global-object from a resource or configuration, proceed as follows:

  1. Make the application navigator visible.

  2. Select one or various global-objects that are displayed in the folder Configuration-Global Variables or Resource-Global Variables and for which you want the revoke the assignment .

  3. From the context menu of the global-objects, select Delete or press the Del-key.
    Result: The global-object in the folder Configuration-Global Variables or Resource-Global Variables is deleted while the actual global-object in the folder Global Variables is kept. Moreover, the INCLUDE_GLOBALS directive in the PLC-object (for the resource or configuration) is deleted.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg In order to unassign the global-object from an ST-program, proceed as follows:

  1. Open the ST-editor for the program.

  2. Search for the INCLUDE_GLOBALS directive, delete the corresponding line and save the change.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg It is possible to undo or redo the assignment as well as the revoking of the assignment of a global-object within the application navigator.