Introduction to RSLogix 5000
This should have been the first practice, a brief introduction to RSLogix 5000 and the organization of a project, how it is structured. I will be updating it and adding content little by little; to visualize the description of each section, click on each of the directories.
RSLogix5000 Controller
1.-RSLogix5000 Controller (Right click -> Properties) Here we will access the properties of our CPU that we will analyze later.
Controller Tags Within this section is where we will declare the variables that will be globally scoped; here they are called Controller tags. All the variables we declare here will be accessible from any program, Task, or event that we develop in our project.
There are 4 types of Tags that we can create: Base, Alias, Produced, and Consumed. The first one, Base, could be said to be the type we use by default when creating a new Tag.
The Alias type are variables that point to another variable, and as its description states, an alias to refer to the same variable; these are usually used when we refer to the inputs/outputs of our controller.
The Produced and Consumed types are the variables we declare when we want to exchange information between two or more Controllers, whether in the same BackPlane or in a ControlNet or Ethernet/IP network. An example can be seen in the next practice

Once we have defined the type of tag it will be, we need to select the data type; here we can use the ones that are already defined by default, or we can use the ones we have defined ourselves, which will be seen in the Data Types section.
If we have two controllers in the same BackPlane, we must select in Scope which Controller it refers to.
External Access: How the variable will be, whether for reading, writing, or reading and writing. In Style, we will select the display format, whether Decimal, Hexadecimal, etc...
With this, we have made a brief description of declaring a Controller variable and its characteristics.
Controller Fault Handler This directory is empty by default, and it is where we will declare a new Program that will execute in case a fault occurs in our Controller. For it to execute, it must be a major fault. Types of Faults
Power-Up Handler Like the previous one, this directory is empty by default; if we want to execute a program after a power loss of our Controller while it is in Run mode, the program we have defined will be the one that executes.
The next image shows a small example of declaring a program for the Controller Fault Handler and Power-Up Handler.
Once we have created our programs, we have one last step to configure them; we need to go to the properties of the Controller and in the Advanced tab, we must specify the program we are interested in for both possible cases.


Tasks
Within the Task section (Tasks) is where we will define, as its name suggests, the tasks that will be executed; by default, when creating a new project, there is the MainTask, which is the task that will execute cyclically and in turn contains the MainProgram where we will write our program.
In the old Controllers, there was the possibility to create 32 periodic tasks or 1 MainTask (Cyclic execution) and 31 Periodic Tasks, whether Event or Cyclic, each of which could contain up to 32 Programs; in the new ones, if I remember correctly, it is possible to create up to 100 programs and up to 100 Tasks.
Moreover, every time we declare a new task or even the main one, we have the option to use phase-based programming, which refers to:
• U.S. standard ISA S88.01-1995 and its IEC equivalent IEC 61512-1-1998, commonly
referred to as S88
• PackML, which was previously under the supervision of OMAC but is now a working
group within ISA
In summary, it would be the phases that a part of a process goes through and its states, that is, whether it is Running, Holding, Stopping, Restarting, etc. To transition from one state to another, transitions occur, which require the use of instructions such as PSC, POVR, PCMD, etc... (I have never used it, so I cannot go into more details; if I do a test later to check its operation, I will update it with an example)
We will focus on the MainProgram, which is the main one; here is where we will declare a routine that will be the main one and from where we will call the others that are within the same program. I mentioned that there can be from 32 to 100 programs in a Task, depending on the Controller.
When declaring a new task, the Program Tags file is automatically generated, where we will declare the variables that are locally scoped to the task that created it; these variables are only accessible from within the task. If we have two independent tasks, there can be a variable with the same name, but each of them is specifically scoped to its task.
Once we have the MainTask, which is the cyclic task, we can declare other periodic tasks, whether cyclic or event-based.
Event tasks that are triggered by a trigger are called processor input interrupts (PII), while cyclic tasks are the selectable timed interrupts (STI).
We will see an image of each of the tasks we can declare.


Motion
Updating ...
Add-on Instruction
Within the Add-On Instruction directory is where we will create our own functions, just as we create our own data types; here we define the functions to perform something specific in our program, which we can later reuse in the same or other projects.
As we just mentioned, an Add-on is a function; when creating a new one, we assign it the name we are interested in, and then its editor opens for configuration.

The definition of an Add-On consists of several parts; the first would be the general part, where we specify the name, a description of it, the programming language we will use, and as modifications are made, a change in the revision.

Once this first part is completed, we will move to the Parameters tab; here is where we will define the input, output, or input and output parameters; for input and output types, they are limited to simple data types. If we want to use the String data type, we specify that it is input/output.

Having specified the parameters we will use, the next tab refers to the internal variables we will need; these variables are local to the function and will not be accessible from outside it.
In my example, I will declare an integer variable that will be an index variable to traverse an array.

The Scan Modes tab is for configuring how our function will execute; by default, the EnableIn bit is set to true, and our code will execute when the conditions in the function call are met, but there is the possibility to configure the execution as Prescan, Postscan, or EnableInFalse. In this example, we leave it as default, but it is good to know the other possibilities.
The next tab is Signature, which refers to signing the function with a unique identifier to protect the function from modifications; later, there will be a chapter dedicated to this.
The following tabs will refer to the creation of the function (Change History) and help with the function's operation that we must complete, just like how to use it in programming languages.
But continuing with the example, we have now created our own Add-On; automatically, in the DataTypes directory, a new file with the name of our function is generated.

Once we have defined all the necessary information and the mode of execution of our function, we can proceed to edit the code; here it is very simple, just by passing an index, we will retrieve the values from an array composed of our data structure defined in the Data Types example.

So far, we have created our own function; now we will use it in the program we are interested in; we simply need to insert it. But before or after that, we need to create a new variable that is of the data type of our Add-On; let's see the example:

Now we will see how the function would look and the parameters we will pass; the parameters defined as InOut are passed directly in the function itself, however, input and output parameters must be passed beforehand or afterward; my input parameter was Index, passing it the index number will return the data I have in the Array; let's check it from the Tags monitor, where we can force them.


DataTypes
Within the Data Types directory is where we will define our own Data Types, called UDT (User Data Types).
By default, there are already a series of data types configured: BOOL, INT, DINT, REAL, STRING, and others more complex. With all these, we can create the ones we are interested in for our program. An example would be creating a data type called Ingredient, which will contain the name, weight, and percentage; on the directory, right-click new Data Types.

Now, we could also define another data type that contains the one we just defined and create our own data structure; now we will create another called Recipe that will contain three ingredients.

So far, we have defined a series of data types, but we have not created any variables of these types; let’s assume we want to create an array of our structure and we create an array of 10 elements of type Recipe at the controller level, called Recipes.

-The next image shows the array we just defined of the data type we have defined, redundancy aside.


Trends
Updating ...
I/O Configuration
Within the I/O Configuration directory is where we will configure our Hardware; when we create a new project, one of the parameters we need to specify is what type of Controller we are going to use; depending on the type of Controller, when we configure the hardware, we will have different cards.
A clear example of this can be observed when we configure a project to work with SoftLogix (1st Image) and another with a ControlLogix (2nd Image).


When configuring it, it is simply a matter of specifying the type of card we have and the slot number where it is located; independently of this, the configuration of each card would then enter into its properties.