Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home

Create Shared Variables Between NJ-R PLC and Omron Robot

Written by Tiaan Kemp

Updated at May 3rd, 2022

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Products
    Automation Systems Control Components Motion & Drives Quality control & Inspection Robotics Safety Sensing Services Software Switching Components
  • Amplify e-Store
    e-Store public
  • Public CSC
+ More

Introduction

With the new NJ-R controller you can commission/program your PLC and Robot, along with other devices through one software package (Sysmac Studio). The advantage of using one software package is you can create share variables created in your PLC Project to the V+ Program created for the Omron Robot.  


Procedure

Step1

First create all variables that needs to be shared between the PLC and Robot program in the Global Variables Section of the PLC Controller:



Delete

Important

To share position/location coordinates to the Robot, use LREAL type variables. 
To store the full position/location data, a 6 Element Array of type Long Real will be required (ARRAY[0..5] OF LREAL). Otherwise you can share individual values of the position depending on how many elements of a position/location coordinate you would like to share.


Step 2

Next declare the same position/location variables that have been created in the PLC Project, in the Robot Variables section.

Delete

Note

Within the Variable section of the Robot Project you can create the following types of variables:

  • Real
  • String
  • Location
  • Precision Point

Other variables, such as the following can be declared and and initialize in the V+ Program:

  • Bool
  • Integer
  • etc.


Delete

Important

PLC LREAL is equivalent to a V+ REAL


Step 3

Finally to link the shared variables between the Programs, declare these created position/location variables with the EXTERNAL Keyword in the V+ Program. In addition to declaring the position/location type variables you can also add bool, integer, etc. These will all be shared between the PLC and Robot Programs. 

After you have declared all shared variables you now need to initialize these variables so they have a default value.

An example of the Declaration and Initialization section can be seen highlighted in the above screenshot.

Example 

Delete

Below is an example of sharing position/location values to the Robot that is received from a FH Vision System and fed into the PLC via the EtherCAT network.

  • In this example the PLC receives a 6 element array of long real positional values from a FH Vision system. The LREAL array variable (Fh_Location) in this example is assigned with simulated values.

     

  • A new Real Array of 6 elements are created in the Robot Variable table.

    Delete

    Info

    Mirror the variables in the PLC global variable table that you want to see reflected in the V+ program. We used the same variables names in both projects but with the case lowered in the robot project.


  • A new empty location vision_location variable was also created as a place holder.


  • In addition to the shared fh_location array variable, robot_bool and plc_var boolean variable are created.
  • The robot_bool variable is triggered via the PLC to start the Robot movement.
  • The plc_var variable is a signal send to the PLC to indicate that the robot is running.


  • Location variables are defined as follow: (X,Y,Z,Rx,Ry,Rz). 
  • vision_location which is used as a place holder. Gets transformed from being an empty location to assigning all 6 elements of fh_location array to each element of the location. 
  •  This means that X = fh_location[0] , Y = fh_location[1] , Z = fh_location[2] , Rx = fh_location[3] , Ry = fh_location[4] , Rz = fh_location[5] 
  • As soon as the initialization section in the V+ program is executed, you will see the updated values for vision_location

     

V+ Sample code:

.PROGRAM program0()

    ;Declaration of shared variables
    EXTERNAL robot_bool, fh_location[]

    ;Initialize shared variables
    robot_bool = FALSE
    SET vision_location = TRANS(fh_location[0],fh_location[1],fh_location[2],fh_location[3],
        fh_location[4],fh_location[5])
    plc_var = FALSE

    ATTACH () ;Attach a device (Robot) to the program
        
    WHILE TRUE DO ;Infinite loop
        IF robot_bool == TRUE THEN
            plc_var = TRUE
            MOVE home
            MOVE point1
            MOVE vision_location
            MOVE point2
            MOVE point3
        END
        plc_var = FALSE
    END
.END
Delete







Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

Definition by Author

0
0
Expand