Software Version used in this video: Do-more Designer 1.4.3
The Datalogic Matrix210 is an awesome little bar code imager that can handle both 1D and 2D bar codes. Instead of the traditional red laser beam scanning the bar code, it actually grabs an image of the bar code with a camera and analyzes the captured image to decode it. And the best news is it is EtherNet/IP compatible, so you can monitor and control it from an AutomationDirect Do-more PLC. I have a Do-more PLC connected to a Stride Ethernet switch which is connected to the Matrix Imager. I am also using the Datalogic CBX500 breakout box as a simple way to connect power to the imager. Once you have the unit setup and calibrated, Get the Datalogic utility called VisiSet, connect to the Matrix210, and under Device, get the devices current configuration. Make sure EtherNet/IP is enabled here. Make sure the operating modes are setup as shown here. And make sure you enable the codes you plan to use. We’ll be using this Code128 in our examples. Send that to the unit and you are ready to use EtherNet/IP. If you have any questions about setting up the Matrix210, call the folks at Datalogic – I found them very friendly and helpful. Now that we have a configured imager, we just setup the Do-more like we always do. I have a new project open and I’m connected to the Do-more. We always start with the system configuration and work our way down this list. Under CPU we can make sure that the Do-more’s IP address is on the same subnet as the imager – if not we can change it here. And the Do-more is a Client controlling the Imager which is a server, so we don’t need to enable the Do-more as a server. We’re not adding any I/O to the Do-more so there is nothing to do here. We’re only using the built-in Ethernet port and not adding any new modules to the PLC so there is nothing to do here. Under Device configuration we could use the built-in EtherNet/IP device to talk to the Matrix210, but it it’s always better to create a new Do-more Device for each piece of hardware you want to talk to via EtherNet/IP. That way no Do-more Device has to manage multiple TCP/IP connections which would slow down your code. Let’s create a new device, we want an EtherNet/IP device, and we’ll call it Matrix210. Great we now have a Do-more Device that will handle all the low level details of dealing with the imager. Which means we don’t have to worry about buffer management, or handshaking, or memory allocation, or any of that stuff. The Do-more does all of that for us. We don’t have any new I/O and the EtherNet/IP device we created doesn’t create any heap structures for us to talk to so we’re done configuring the Do-more and we’re ready to talk to the Matrix210 imager. To do that, we just grab an EtherNet/IP instruction, drop it on the rung and fill in the blanks. We want to use our new Martix210 Device and he is at this IP address. This is where we put the codes we use to talk to the EtherNet/IP device. Where do you get the codes? Over on the Datalogic website search for the Matrix EtherNet/IP User Guide. I got this list here. They are all the same, just pick one. This user guide lists all the things you can do with the imager via EtherNet/IP. Let’s do something simple for our first example – let’s get the vendor ID which is always in the Identity object. And here it is. Looks like we need Class 1, Instance 1 and Attribute 1 to get the Vendor ID. We want to Get this information and we’ll do it on the leading edge of the ladder contact. We’ll use these status bits and we’ll put the Vendor ID in D1 and the number of bytes actually returned in D2. The Vendor ID is an Integer, so we expect a maximum of 2 bytes. Great. Accept that and add a contact to enable the instruction. Remember – we told the instruction to start on the rising edge of this contact – which is indicated by this triangle - so we don’t need a rising edge contact here. Looks good to me, so let’s accept all changes and write it out to the Do-more. Let’s bring up a dataview so we can control this and add the contact and the result. Make sure we’re running, enable status and enable editing for the dataview. If we toggle this contact we get this 850 which according to the manual is the Vendor ID. Perfect. Here’s the sequence of events we need to get the barcode: First we need to trigger the Image. Then we need to wait a little while for the imager to do its thing. Then we read this item sequence number and fragment sequence number and then we write those back to the imager to acknowledge that we actually got the barcode. I went ahead and created this little Get Bar Code program so you wouldn’t have to wait while I typed all this stuff in. Let’s take a look at that. In stage 0 we activate the message trigger. It’s just the one EtherNet/IP instruction talking to our Matrix210 Device at this IP Address, using these codes and issuing a write with bit 7 set in this variable. Bit 7 of this byte is what’s going to trigger the imager. If that’s successful we jump to stage 10, if not, we jump to stage 99 and increment an error counter. Stage 10 releases the trigger so it’s the exact same instruction except it sends this register which has a zero in it to clear the trigger bit and it jumps to stage 20 when done. In stage 20 we give the imager a little time to process the image. We start a timer and jump to stage 1 when the timer is done. Which also shows that Stages don’t have to be in numerical order. In Stage 1 we Get the data into this string using these EtherNet/IP attributes from the user guide and jump to stage 2 when we are successful. In stage 2 we get the Item Sequence number into this memory location and jump to stage 3 where we get the Fragment Sequence number into this memory location and jump to stage 4. In stage 4 we write the Item Sequence number back to the imager using a Set command and in stage 5 we write the Fragment Sequence number back to the imager. Again ,writing the Sequence numbers back to the Imager is what acknowledges the receipt of the data so the imager can process the next bar code. When done we exit the program. Stage programming makes sequencing things like this so easy because it takes care of all of the interlocking and transitions automatically. So all of these EtherNet/IP instructions we used are the pretty much the same aren’t they? We just look up the codes in the user guide for what we want to do and fill in the blanks. Back in the main program, we run that Get Bar Code program on a rising edge of a contact. Accept all of that and write it out to the Do-more. Let’s add the new contact that triggers that program and the Bar Code result to our dataview. Toggle the contact and we get our bar code. Change the bar code, trigger another read. And we get the new result. Perfect. This is by no means a complete example. There’s a lot more of information you can pull from the imager and use to your advantage all of which is in that EtherNet/IP manual. But for now, this ought to be enough to get you up and running. If you have any questions about using EtherNet/IP on the Do-more, contact AutomationDirect’s free award winning tech support during regular business hours. Don’t call them about Datalogic Imagers or any other device AutomationDirect doesn’t currently have – they will just send you to that vendors support. So save yourself a phone call. And check out the forums. That’s another great place to get information from experienced - and very helpful – Do-more users. Spend Less. Do more. With Automation Direct.