Software Version used in this video: Do-more Designer 1.4.3
Using the Do-more to talk to an EtherNet/IP encoder like this one is easy. It really only has one class, one object in that class and the usual services. There is a table of class attributes, but it only support attribute #1 – the rev number. How do I know all of that? It’s in this manual I found on-line. Looks like Appendix B has the Common Industrial Protocol Object definitions – which is what EtherNet/IP uses - so we scroll down to that and here is everything we need. Here are the services that are supported – all the usual suspects. Here is where it tells me the only Class Attribute supported is #1. They define all of their units here – that will be handy in a minute. And here is the one EtherNet/IP position sensor object and all of its attributes. Looks like we can ask it for the total number of attributes, a list of which attributes are supported – notice they go from 1 to 2 then to 10, 11, 12 etc. so not all attributes are used here. We can get the current position and the type of device; specify the counting direction, etc. There are lots of things we can do via EtherNet/IP with an encoder. And remember – ALL Ethernet/IP encoders use this same table of attributes, so code you write for this encoder will work on any vendors EtherNet/IP encoder that supports these same attributes. And that’s one of the main advantages of using EtherNet/IP – code portability and vendor independence. So let’s do an example or two. We have a Do-more at this IP Address going into a Stride Ethernet switch, which goes to the EtherNet/IP encoder at this IP address. As always, we start with the configuration. EtherNet/IP doesn’t affect the CPU, the I/O or the Module configuration. It does create a new device. And while we could use this built in EtherNet/IP device, it is much better to create a separate new device for each piece of EtherNet/IP hardware. Otherwise one device will have to manage multiple TCP/IP connections which can slow things down. Fortunately, it’s easy to create a new device. Click on NEW, select the EtherNet/IP Explicit Client, Give it a name – we’ll call it “AMCI_Encoder.” And we’re done. That’s all there is to creating an EtherNet/IP device. Now we just drag an EtherNet/IP explicit message instruction into our code and fill in the blanks. Select our new AMCI_Encoder Device. Enter the encoder’s IP Address. The default port is fine. This device only has one class and Appendix B tells us its Class 23 hex, so that goes here. There’s only one table so that’s going ot be instance number one. And now we just pick which parameter – or ‘attribute’ – we want – how about the current position, which is attribute 0A hex or 10 decimal. And that goes here. We’ll use these for our status bits and D1 for the result and D2 for the number of bytes received. The value is a DINT which the appendix tells us is 32 bits or 4-bytes of memory, so we put that here. That’s it. Let’s add a contact so we can activate this instruction. Accept everything; write it out to the do-more. Add the contact and the result memory locations to the Data View. Make sure the PLC is running, and toggle the contact. Sure enough, the instruction was successful, we got all 4 of the expected bytes and this is the value we got. I’ll rotate the encoder shaft and toggle another read. And it changes. Perfect. Let’s add the ability to preset the encoder value so we can set the encoders initial output to whatever we want. It’s very similar to what we just did, so we’ll copy that and paste it here. Looks like the preset is attribute 19 – that goes here - and we wat to set the attribute this time. We’ll use these for our status bits and we’ll retrieve the present value from D0, which is 4 bytes long, so that’s fine. Perfect. Let’s toggle that on C101. Accept all; write it out to the Do-more. Let’s add our preset to the Dataview, along with its control bit. Make sure we are running, rotate the encoder a little and read the current value of the encoder. Now let’s set our preset at 100 and toggle its control bit to write it to the encoder. Now toggle the current value bit and its right where we expect it to be. And that’s all there is to talking to an encoder – any EtherNet/IP enabled encoder – from the Do-more. Just pick the attribute you want from the table in the manual, and the service you want and your in business. If you have any questions, please contact AutomationDirect’s FREE award winning tech support during regular business hours – they will be happy to help you with any AutomationDirect parts. The AMCI encoder isn’t an AutomationDirect part so please don’t and ask them about that, but you can ask folks on the forums – they love to share their years of experience! Just don’t post any questions directed at AutomationDirect’s support staff there, they don’t monitor the forums on a regular basis. Spend Less, Do More. With AutomationDrect.