Cookies are important for this site to function properly, to guarantee your safety, and to provide you with the best experience. By clicking OK, you accept all cookies. For more information, please access our Privacy Policy.
Table of Contents
Tutorials / 
Local, Axis, Axes Group, Cam Data, and Function Block Instance Variables Explained in Omron Sysmac Studio
Intermediate

Local, Axis, Axes Group, Cam Data, and Function Block Instance Variables Explained in Omron Sysmac Studio

Omron
Sysmac Studio
PLC Programming

Introduction

Omron Sysmac Studio is a comprehensive automation software. It requires a solid understanding of various programming concepts. Variables are one of those concepts that play a crucial role in programming efficient automation solutions.

Local Variables are being used to store data within a specific task, function, or function block. Axis Variables are employed to define and manipulate data related to motion control axes. On the other hand, Axes Group Variables group multiple axes together and apply operations to them simultaneously. Cam Data Variables are used to store and manipulate data related to cam profiles for motion control. Finally, Function Block Instance Variables are used to store data specific to an instance of a function block.

So first, programmers need to understand these variables and their applications. Then, they can create effective industrial programs using Omron Sysmac Studio.

Prerequisites

What you will need to follow along with this tutorial:

Local Variables Types

Local variables can be registered for use within a single POU (program, function, or function block). The available groups for local variables are as follows:

  • Internal variables: Refer to the variables created within programs for local use. They also refer to generated variables within functions or function blocks for internal use.
  • In/Out variables: Utilized to generate input, output, and in-out variables within functions or function blocks.
  • External variables: Used to record variables sourced from the global variable table. It allows a program, function, or function block to access data outside its scope.
  • Return values: Employed to record the output values returned by functions.
Figure 1.1 - Omron PLC Programming | Local variables types
Figure 1.1 - Omron PLC Programming | Local variables types

Accessing the Tab Page for Local Variables

Consider the following example that utilizes a registered ladder diagram program. Double-click Section0 in Programming -> POUs -> Programs -> Program0 within the Multiview Explorer. It will display the section in the Edit pane. Left-click on the Variables Bar or press the Ctrl+Shift+V keys. It will display the local variable table. Choose the variable category from the side tabs within the local variable table. Then, register the local variable as needed.

Figure 2.1 - Omron PLC Programming | Accessing the local variable tab page
Figure 2.1 - Omron PLC Programming | Accessing the local variable tab page

Generating Local Variables

You can generate local variables within the Ladder editor. Click over a new input or output instruction in the Ladder editor. Assign a name to the new variable. The newly entered variable name will be registered automatically on the Internals side tab page.

Figure 3.1 - Omron PLC Programming | Creating local variables 
Figure 3.1 - Omron PLC Programming | Creating local variables 

Relocating Internal and External Variables

What should be done to transfer an internal variable to the global variables? Right-click over the desired internal variable and choose Move to Global from the pop-up menu. This action will register the selected variable in the global variable table. Also, the desired variable will be removed from the internal variables and transferred to the external variables.

Figure 4.1 - Omron PLC Programming | Moving an internal variable to the external variables table
Figure 4.1 - Omron PLC Programming | Moving an internal variable to the external variables table

What should be done to transfer an external variable (a global variable) to the internal variables? Right-click over the variable you wish to move and choose “Move to Internals” from the pop-up menu. It will move the chosen variable from the external variables to the internal ones.

Figure 4.2 - Omron PLC Programming | Moving an external variable to the internal variables table while remaining in the global variables table
Figure 4.2 - Omron PLC Programming | Moving an external variable to the internal variables table while remaining in the global variables table

If you transfer an external variable to an internal variable, a confirmation dialog box will appear. The software displays this box to ask whether you want to delete the corresponding global variable. Before deleting a global variable, be sure it is not utilized in any other POU.

Figure 4.3 - Omron PLC Programming | Moving an external variable to the internal variables table while removing it from the global variables table
Figure 4.3 - Omron PLC Programming | Moving an external variable to the internal variables table while removing it from the global variables table

Updating a Ladder Program Due to the Change in In-Out Variables

You can modify the in-out variables of a function or function block. Then implement those changes in a called function or function block in ladder programming. To do this, right-click over the in-out variable set and choose the Apply inputs and outputs to the ladder program from the pop-up menu. You will then be asked to confirm whether you want to update all called functions and function blocks with the changes.

Figure 5.1 - Omron PLC Programming | Applying change in in-out variables to a ladder program - First method
Figure 5.1 - Omron PLC Programming | Applying change in in-out variables to a ladder program - First method

Updating a Ladder Program Due to the Change in Return Values

By modifying the data type of a function's return value and comment, you can apply the changes to a called function in Ladder programming. To do so, right-click over the set of the return value variable and choose the Apply return values to the ladder program from the pop-up menu. A message box will appear, asking for confirmation to update the called function.

Figure 6.1 - Omron PLC Programming | Applying change in return values to a ladder program - First method
Figure 6.1 - Omron PLC Programming | Applying change in return values to a ladder program - First method

Is it possible to apply changes to the in-output variables of functions or function blocks and the return values of functions in another way? Yes. How? You can right-click over the called function or function block in Ladder programming and select Update from the pop-up menu.

Figure 6.2 - Omron PLC Programming | Applying change in in-out variables or return values to a ladder program - Second method
Figure 6.2 - Omron PLC Programming | Applying change in in-out variables or return values to a ladder program - Second method

Generating Axis Variables

In programming, an axis variable is a structure variable employed to define an axis within a program. It comprises control-related members for managing the axis settings. It also includes monitoring-related members for observing the axis status within programs.

The axis variable is automatically included as a global variable when an axis is created within the Axis Settings. In the Multiview Explorer, navigate to Configurations and Setup > Motion Control Setup. Then, right-click on Axis Settings, and choose Add -> Motion Control Axis from the pop-up menu. It will add MC_Axis000 to the tree.

Figure 7.1 - Omron PLC Programming | Creating axis variables
Figure 7.1 - Omron PLC Programming | Creating axis variables

To access the Global Variables table, navigate to Programming -> Data. Then, double-click on the corresponding option in the Multiview Explorer. The global variable table is populated with the MC_Axis000 Axis Variable automatically.

Figure 7.2 - Omron PLC Programming | Populating the global variables table with created axis variable automatically
Figure 7.2 - Omron PLC Programming | Populating the global variables table with created axis variable automatically

What will happen if you remove an axis variable from Axis Settings? The corresponding variable in the global variables table will be automatically deleted too.

Generating Axes Group Variables

An Axes Group Variable is used as a structure variable to define a group of axes. These axes are linked for synchronization or interpolation purposes within programs.

After creating an axes group, the Axes Group Variable is added to the global variables table as an automatic process. Navigate to Configurations and Setup -> Motion Control Setup in the Multiview Explorer. Then, right-click on Axes Group Settings. Choose Add -> Axes Group Settings from the pop-up menu, which will add MC_Group000 to the tree.

Figure 8.1 - Omron PLC Programming | Creating axes group variables
Figure 8.1 - Omron PLC Programming | Creating axes group variables

Navigate to Programming -> Data in the Multiview Explorer and double-click on Global Variables. It will allow you to verify that the MC_Group000 Axes Group Variable has been added automatically to the global variables table.

Figure 8.2 - Omron PLC Programming | Populating the global variables table with created axes group variable automatically
Figure 8.2 - Omron PLC Programming | Populating the global variables table with created axes group variable automatically

What will happen if you remove an Axes group variable from Axes Group Settings? The corresponding variable in the global variables table will be removed automatically too.

Generating Cam Data Variables

The cam data variable specifies how a slave axis moves in sync with a master axis. It enables interpolation and synchronization of electronic gears and cams. By incorporating variables into your programs, cam movements can be specified.

Automatically upon creation of cam data, the cam data variable becomes a global variable. To add CamProfile, navigate to Cam Data Settings under Configurations and Setup in the Multiview Explorer. Then, right-click, and select Add from the pop-up menu. It will add Cam profile 0 to the tree.

Figure 9.1 - Omron PLC Programming | Creating cam data variables
Figure 9.1 - Omron PLC Programming | Creating cam data variables

Navigate to Programming - Data and then Global Variables in the Multiview Explorer and double-click on it. This way, you can ensure that the cam data variable has been added automatically to the global variables table.

Figure 9.2 - Omron PLC Programming | Populating the global variables table with created cam data variables automatically
Figure 9.2 - Omron PLC Programming | Populating the global variables table with created cam data variables automatically

What will happen if you remove a cam data variable from Cam Data Settings? The corresponding variable in the global variables table will be removed automatically too.

Generating Instance Variables for Function Blocks

After creating a function block instance, it gets registered as a data type in the local variable table. You need to provide the instance name for the function block if you want to call the function block from a different POU.

To access the instance of the function block instruction you formed in the Ladder editor, left-click on Enter Function Block. To register a function block instance in the local variable table as an instance variable, input an instance name and then press the Enter key.

Figure 10.1 - Omron PLC Programming | Creating function block instance variable 
Figure 10.1 - Omron PLC Programming | Creating function block instance variable 

Conclusion

In conclusion, you learned that local variables are utilized exclusively within a single POU. You also learned local variables are divided into internal, external, in-out, and return value groups. You found that relocating variables from internal to external or vice versa is possible. Also, you grasped how to update a ladder program due to the change in in-out variables and return values. You understood how to create the axis, axes group, cam data, and function block instance variables. Additionally, you learned once these variables are created, they are added to the global variable table instantly. Removing any of these variables from their respective settings will remove them from the global variable table.

‍