Introduction
This article is a brief introduction into the usage of the CIP variable read write function blocks for the CJ2 or CS series PLC.
Information
These are custom function blocks and have not gone through the same validation process as the built in functions for the CS/CJ series .
CIPNXVarMaker
An optional ‘helper’ Function Block (FB) to create variable names with or without array offsets for use with the CipVariableRead and CipVariableWrite FB’s .
The CipNxVarMaker FB is designed to be used in one of two options – with external base names provided or using an internal base name.
• Option 1
When using external names - a ‘base’ variable name should be already defined (elsewhere). UseExtStringByRef = TRUE
• Option 2
When using internal names – the FB should be edited by the user. This may mean multiple copies of FB source if different variable names are required (hence Option 1 recommended). UseExtStringByRef = FALSE
CIPVariableWrite
Function Block (FB) to ‘Write’ (send) a single item or block of data from an Omron CJ/CS PLC to a Sysmac NJ/NX Controller via in-built Ethernet/IP (EIP)
port. It enables writing from CJ/CS memory (CIO/DM, etc.) to Sysmac Network Published Variables.
The operation is like the PLC ladder SEND instruction but using Common Industrial Protocol (CIP) variable access rather than Omron FINS protocol. This means that a remote Sysmac CPU can be accessed by IP address only and no FINS addresses need be set (FINS Networks and FINS Nodes).
The FB is written in Structured Text and can be used on CJ or CS CPU’s (V4) with addition of EIP port. These FB’s will ONLY work by accessing Sysmac CPU EIP ports (i.e. not NJ CPU+CJ1W-EIP21 unit).
It can only be used with Ethernet/IP units (EIP). At time of writing this refers to CS1W-EIP21 (V2 & V3), CJ1W-EIP21 (V2 & V3), CJ2H-CPU6x-EIP and CJ2M- CPU3x.
Setup
1. Configure the inputs and outputs of the block as per below.
2. Configure variables on the global variable table of the NX/NJ as "Publish Only".
The below example shows how you might write to a variable of type WORD called “WdSingle”.
The below example shows how you might write 10 elements to a Integer array named IntAryIn starting at index 2.
CipVariableRead
A Function Block (FB) to ‘Read’ (recv) a single item or block (array) of data from an Omron Sysmac NJ/NX Controller Network Published Variables via in-built
Ethernet/IP (EIP) port to CJ/CS PLC memory (CIO/DM, etc.).
The operation is like the PLC ladder RECV instruction but using Common Industrial Protocol (CIP) variable access rather than Omron FINS protocol. This means that a remote Sysmac CPU can be accessed by IP address only and no FINS addresses need be set (FINS Networks and FINS Nodes).
The FB is written in Structured Text and can be used on CJ or CS CPU’s (V4) with addition of EIP port. These FB’s will ONLY work by accessing Sysmac CPU EIP ports (i.e. not NJ CPU+CJ1W-EIP21 unit). It can only be used with Ethernet/IP units (EIP). At time of writing this refers to CS1W-EIP21 (V2 & V3), CJ1W-EIP21 (V2 & V3), CJ2H-CPU6x-EIP and CJ2M- CPU3x.
Setup
1. Configure the function block as per below
2. Configure variables on the global variable table of the NX/NJ as "Publish Only".
The below example shows how you might read from a variable of type WORD called “WdSingle”.
The below example shows how you might read 10 elements from a Integer array named IntAryIn starting at index 2.
Example Program
An example program and the function blocks may be downloaded here.