Here are the minimum requirements to use Ethernet/Ip with the Productivity series CPU.
For the Productivity CPU to communicate to the Nitra Valve, these are the communication
parameters that we will need for this setup.
So the input data is what you are reading from the Valve and the output data is what
we are writing to.
The input as we see here consist of a single byte which is 8 bits.
The output word consists of 2 bytes or 16 bits.
1 bit for each solenoid possible on the valve block.
To setup the CMV valve for etherent communication, you will need obtain the Ethernet/Ip configuration
tool from our website.
So, Navigate to our website and under downloads select software.
Find the EIP software download and install into your PC.
Once installed open up the EIP configuration tool and then select “Scan for devices.
Once you see your OEM Device.
Select and put in the Ip Address you need for your system.
I am going the following Ip address for this example.
So, open up the Productivity project, Double click on the Hardware configuration and then
select the Ethernet/Ip Tab from the top.
Now Drag the generic client into the grey area, in the middle.
You can place an individual tag for these elements or you can check the box Use Structure.
This will create a structure of tags that can be used for this device, making it a lot
easier on the programmer to create use and find the correct tags.
I am going to select Use Structure and give it the following name.
Type in a name for this device.
Type in the Ip address that we configured into the CMV valve.
The TCP Port number is always 44818.
Now click on this Green cross and that select Add Explicit Message.
All of the tags will also be part of the structure.
This will be the polling rate for this device I am going to leave it at the RPI as default
of 250msec.
I highly recommend that the RPI time should not be faster than the application requires.
When you select ok you will now be creating the tags that will make up this structure.
Now that the client is configured.
You will need to place two Ethernet/Ip Explicit messaging instructions into your code.
One for the input and one for the output data block.
Let’s begin with the Input data which is the read from valve.
Place the EMSG instruction into your code.
Here I will also populate this instruction by the Use structure option.
Make sure to select the device name we created in the hardware configuration.
Now for connection, You have two options here.
You have Connected or Unconnected.
The main functional difference here is that if connection is lost when using Connected
Explicit, all of the valves will be turned off.
If you select Unconnected and lose communication the valves will stay at the last state sent
to it.
Since we are doing the read, here, we will be using the Get Attribute.
And from the information that was provided before we see that the instance ID is 101.
Now this is the part that catches some.
The data array data type that we use here must match the data size of the input data
block.
So from this information we see that this is done in bytes.
So the data type of our data array must be an 8 bit data block.
To create this data array type in the name that you want for your data array and when
you click in the number of elements the following will appear.
Here we need to simply change the data type 8 bit unsigned and since we only need 1 byte
we can leave the columns as 1.
Click ok.
Then click OK on the instruction.
This popup will complete the creation of the structure for this instruction.
So that takes care of the Read now lets enter the write instruction.
We will input another EMSG instruction into the code.
I am going to put the following for the structure.
When we get to Service we will be using the Set to write to the valve.
From this information that was provided earlier we can see that the instance ID is 100.
For the data array we will use the following and when you click in number of elements this
popup will appear to create the array.
As before we will need to change the data type to 8 bit unsigned but this time since
the block uses 2 bytes we will need to change the columns to 2 also.
Click Ok.
Now change the Number of elements to 2.
Click ok on the instruction and this will complete the creation of the Structure for
this instruction.
So that takes care of both the Read and Write instructions.
Next we need to be able to address the Solenoid outputs in the ouput data block.
From this table we can see how the 2 bytes address each of the solenoids that are possible
on the valve.
SO that would be how the outputs are distributed in the data array we created for the output
block.
So to control this from our ladder code I am going place a Normally open contact with
this Boolean to trigger this bit of word that would address the 1st solenoid.
Now the last thing we have to do here is to enable the Ethernet/Ip communications.
So if we go back to our Ethernet/IP Client, we can see that this tag will need to be turned
on to enable the Ethernet/Ip connection.
SO I am going to make a normally open contact with this Boolean to trigger the enable of
this communication.
So, that completes the ladder code that we will need for this example.
Now transfer that to your CPU.
With the project transferred let’s open up the Dataview, and test our code.
Let’s enter the tags to enable the comms and to control the 1st solenoid.
Send the edit to First enable the communication.
Now send the edit to turn on the solenoid.
You should immediately see the valve turn on.
We can also view the status of the Read by entering in the CMV_Read data array here.
This table defines what the status word indicates on the valve.
If you need any help with using an Automation Direct device please contact Automation Direct’s
free, award winning Technical support team during regular business hours – they will
be happy to help.
And don’t forget the forums.
There are lots of folks there that love to share their years of experience.
Just don’t post questions directed at Automation Direct’s Technical support staff there,
they do not monitor the forums on a regular basis.