Article translated with the assistance of AI tools. Images and parts of the content will still be reviewed.
This tutorial describes a way to store retentive and persistent variables in the internal file memory of the PLC as an alternative to using the retentive memory area, utilizing the Recipe feature and functions that enable on-demand data writing and data restoration during application startup.
Components
Software: Mastertool IEC XE 3.34
PLC: XP340
Tutorial Sections
1. ARCHITECTURE
2. DEVELOPMENT
2.1. Recipe Manager in MasterTool
2.2. Inserting Recipes
2.3. Programming
2.4. Operation
1. ARCHITECTURE
2. DEVELOPMENT
The retentive and persistent memory area of the Xpress, traditionally used to store parameters, setpoints, and process adjustments, has a limited capacity. This is because its data is stored during PLC power down, which classifies this area as part of the controller's non-volatile memory. For this reason, as an alternative, it is possible to store this type of variable in the internal memory (User File Memory) using the Recipe feature along with functions that allow data writing on demand and restoration during application startup. The procedure for inserting the Recipe function and the correct way to use it are described throughout this tutorial. With this procedure, it will be possible to expand the use of retentive or persistent variables because it offers additional storage space that does not interfere with the capacity previously established for these data in documents related to the Nexto Xpress series.
2.1. Recipe Manager in MasterTool
First, we must insert the recipe manager, create a recipe group in Mastertool, and add a column (recipe) where the variables will be stored.
In this tutorial, we want to save some variables that are inside the POU UserPrg.
To add the recipe manager, right-click on “Application” in the device tree, go to the “Add Object” option, and add the “Recipe Manager”.
Within the properties of the Recipe Manager, check the options “Recipe management in the PLC” and “Save recipe changes to recipes files automatically”.
Then right-click on “Recipe Manager” and go to “Add object” and add a “Recipe Definition”.
2.2. Inserting Recipes
Double-click on “Recipe Definition” and inside it right-click and add a recipe by clicking “Add New Recipe”.
In this example, we will call this recipe “Recipe1”.
After that, we will add the variables from UserPrg. To do this, double-click the “Variable” field and click the box with two dots (“..”), as shown in the image below.
This will open the variable input wizard. We must find the variables and add them. In our example, our variables are inside “UserPrg”.
2.3. Programming
In this tutorial, we will use only two commands, one for reading variables and one for writing.
For this, we need to declare a variable of type “RecipeManComands”. In this tutorial, we will call the variable “RecipeCmd”.
Within this "RecipeManComands" structure, there are several commands that can be used and explored later, but the ones we will use are “.WriteRecipe” for writing the recipe to variables and “ReadAndSaveRecipe” for reading the variable values. Both commands include the parameters “RecipeDefinitionName” and “RecipeName” which, in this tutorial, will be “Recipes” and “Recipe1”, respectively.
For example purposes, we created two more boolean variables in this tutorial, “xSaveRecipes” and “xReadRecipes” to trigger the two commands.
2. 4. Operation
For testing purposes, we must log in, put the PLC in RUN mode, add values in the “prepared value” field for the recipe, insert the values with the “CTRL+F7” command, and set “xSaveRecipes” to TRUE.
With “xSaveRecipes” set to TRUE, you are saving Recipe1, making it possible to load the recipe later.
To test the functionality of loading Recipe1, we will perform a Warm Reset to erase the previously entered values.
Put the PLC back into RUN mode and set “xReadRecipes” to TRUE to load the previously created recipe.
3. VIDEO
Comments
0 comments
Please sign in to leave a comment.