In this post, we will see how to create user-defined data types and function blocks in Studio 5000 software.
As we know, user-derived data types and function blocks play a very important role in PLC software. A programmer finds it easier to develop the logic faster and more efficiently if there is a repeated type of logic in the whole program.
That means, suppose there are 10 motors and each motor should start by pressing the start button and stop by pressing the stop button.
Instead of writing the same logic for all the 10 motors every time, he can just create his own library or data type which will contain a common logic; and it can be used in multiple instances within the whole logic.
User-defined types are available in almost every PLC software. In this post, we will see one such software of Rockwell Automation – Studio 5000. This software is used to program Rockwell PLCs like Compact Logix, Control Logix, and Flex Logix series. It is a very high-end one and has many advanced features available to make the task easier for the programmer.
User-Defined Data Types in Studio 5000
So, what is a data type? A Boolean, integer, real, etc.; the terms which a programmer has faced while creating a variable is called data type. It defines the type of data or variable used.
User-defined data type means a programmer can manually create his own data type and give it any name according to his convenience. Refer to the below steps to create a user-defined data type in Studio 5000.
As shown in the image, expand the assets category. Expand the data types category and in that, right-click the user-defined option as shown to create a new data type.
On clicking it, the following window will appear. Here, you have to click add a member as shown; to add variables of the data type you want; and give a name for the data type.
For example, as discussed earlier, two variables have been created – start and stop. Both these variables are of Boolean type.
Clicking Ok will create a data type of the name motor. Now, understand the logic. If you are creating a variable named M1 of type Boolean; you can create it as type motor also.
This means, if created, then the M1 variable will have two members accordingly – M1. Start and M1. Stop.
Add-On Instructions (User Defined Function Blocks)
A user-defined function block is a library created by the programmer himself. For example, as the timer is a predefined library that comes inbuilt with the PLC software, a user-defined library is the one that will be customized by the programmer according to his requirements accordingly.
Refer to the below steps to create a user-defined function block in Studio 5000.
As shown in the image, expand the assets category. Right-click the Add-on Instructions option as shown to create a new function block.
On clicking it, the following window will appear. Name the library according to you and define the programming language.
Here, I have named the function block as Motor_Logic and chosen the ladder diagram as the programming language.
On clicking Ok, the following window will appear.
In this way, we saw how to create user-defined function blocks and libraries in this software.
Comments
Post a Comment