Using the User Data Type in Local Variables for a Program

Step Action
1

Open your project that contains the User Data Type.

2

Open the Local Variables file for your program.

3

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

Variable Kinds:

  • VAR: Non-constant local variable.

  • VAR_CONSTANT: This is a constant local variable.

  • VAR_EXTERNAL: This is a reference to a non-constant variable that is external to this program.

  • VAR_EXTERNAL_CONSTANT: This is a reference to a constant variable that is external to this program.

4

Give the local 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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LM124-3