Using the User Data Type in Global/Direct Variables

Step Action
1 Open your project that contains the User Data Type.
2

Open the Global/Direct Variable window.

3

In the blank line for adding a Global Variable, select the Variable Kind of your variable.

Variable kinds:

  1. VAR_GLOBAL: this is a non-constant global variable.

  2. VAR_GLOBAL_CONSTANT: This is a constant global variable.

4

Give the global variable a name in the Variable Column.

5

Select the User Data type for the variable in the Type column.

6

To setup initial values of the elements of the User Data Type, double-click on the space in the Initial Value column. A window will open to allow you to set initial values for the elements of the User Data Type.

Note: This step is optional.

7

Check the Retain box if the variable should store its value on power cycle of the PLC.

Note: This step is optional.

8

Add a Comment to provide a description of the variable.

9

Use your variable in your code. ‘variable_name.element_name’ is the method for using elements of the User Data Type.

 

 

 

LP305-2