UDTs are one of the most important aspects to PLC programming you can learn. This is because they inherently force structure, and structure is good!

Like many PLC development environments, Allen Bradley’s Studio 5000 Logix Designer is capable of creating User-Defined Data Types.

Creating The UDT

Right clicking on the User-Defined folder in the Assets > Data Types folder will allow you to select New Data Type…

Clicking this will open a new window:

New UDT Window

Fill in the Name and Description with data that lets people know why this UDT exists. Once that’s complete, it’s time to fill in the Members area.

The Members area contains the Variables and Data Types that will make up the UDT.

Members required for the UDT_Scaled_Data UDT

The above image shows the Members area filled in with the required variables that we need this UDT to contain.

At this point, we can click OK in the bottom right corner to save our UDT.

New UDT in the User-Defined folder

Our new UDT now appears in the User-Defined folder.

Creating An Instance Of The UDT

Now that we have our UDT created, we need to actually instantiate it (create an instance of it) in order to access any of the data or write anything to it.

In this example, we’ll create our instance of the UDT_Scale_Data in the Controller Tags area of the project

Don’t forget to select Edit Tags from the tab at the bottom!

Here we’ll create a variable for our UDT_Scale_Data:

As soon as we give the Level_1_Scale_Data variable the Data Type of UDT_Scale_Data, the variable becomes populated with the Members from the UDT we defined earlier.

These variables are accessible now via the path Level_1_Scale_Data.Raw_Min for example.

Using UDTs In Logic

Let’s take a look at an example of using these values in a Ladder Logic Routine:

The above shows how the Level_1_Scale_Data UDT inner Members are accessed.

Once you’ve defined your UDT, you can then create an AOI (Add-On Instruction, we’ll cover this in a separate post!), or parameter based routine that interacts with the UDT as a whole:

Entire UDT_Scale_Data is passed to the Scale_Function

This makes code easy to reuse, structured and manageable in the future.


Check Out Another Post

One thought on “Rockwell – Allen Bradley – Studio 5000 – Creating User-Defined Data Types (UDTs)”

Leave a Reply