Dataman® Communications and Programming Guide: Distribué Par
Dataman® Communications and Programming Guide: Distribué Par
Communications and
Programming Guide
Distribué par :
Contact :
12/2/2011 [email protected]
Siège social :
2 rue René Laennec
51500 Taissy
France
www.hvssystem.com
Legal Notices
The software described in this document is furnished under license, and may be used or
copied only in accordance with the terms of such license and with the inclusion of the
copyright notice shown on this page. Neither the software, this document, nor any copies
thereof may be provided to, or otherwise made available to, anyone other than the
licensee. Title to, and ownership of, this software remains with Cognex Corporation or its
licensor. Cognex Corporation assumes no responsibility for the use or reliability of its
software on equipment that is not supplied by Cognex Corporation. Cognex Corporation
makes no warranties, either express or implied, regarding the described software, its
merchantability, non-infringement or its fitness for any particular purpose.
The information in this document is subject to change without notice and should not be
construed as a commitment by Cognex Corporation. Cognex Corporation is not responsible
for any errors that may be present in either this document or the associated software.
No part of this document may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, nor transferred to any other media or language
without the written permission of Cognex Corporation.
Copyright © 2011 Cognex Corporation. All Rights Reserved.
Portions of the hardware and software provided by Cognex may be covered by one or more
of the U.S. and foreign patents listed below as well as pending U.S. and foreign patents.
Such pending U.S. and foreign patents issued after the date of this document are listed on
Cognex web site at http://www.cognex.com/patents.
VisionPro
5481712, 5495537, 5548326, 5583954, 5602937, 5640200, 5751853, 5768443, 5825913, 5850466, 5872870, 5901241, 5943441, 5978080, 5978521,
5987172, 6005978, 6039254, 6064388, 6075881, 6137893, 6141033, 6167150, 6215915, 6240208, 6324299, 6381366, 6381375, 6411734, 6421458,
6459820, 6490375, 6516092, 6563324, 6658145, 6687402, 6690842, 6697535, 6718074, 6748110, 6771808, 6804416, 6836567, 6850646, 6856698,
6920241, 6959112, 6963338, 6973207, 6975764, 6985625, 6993177, 6993192, 7006712, 7016539, 7043081, 7058225, 7065262, 7088862, 7164796,
7190834, 7242801, 7251366, 7313761, EP0713593, JP3522280, JP3927239
DataMan
5742037, 5943441, 6215915, 6236769, 6282328, 6381375, 6408109, 6457032, 6690842, 6941026, 7175090, 7181066, 7412106, 7427028, 7549582,
7604174, 7614563, 7617984, US-2005-0087601-A1, US-2006-0131418-A1, US-2006-0131419-A1, US-2006-0133757-A1, US-2007-0090193-A1, US-2007-
0091332-A1, US-2007-0152064-A1, US-2007-0170259-A1, US-2008-0004822-A1, US-2008-0011855-A1, US-2008-0142604-A1, US-2008-0143838-A1, US-
2008-0158365-A1, US-2009-0090781-A1, US-2009-0108073, US-2009-0121027-A1, US-2009-0166424-A1, US-2009-0294541-A1, WO06065619A1,
EP1687752
CVL
5495537, 5548326, 5583954, 5602937, 5640200, 5717785, 5751853, 5768443, 5825483, 5825913, 5850466, 5859923, 5872870, 5901241, 5943441,
5949905, 5978080, 5987172, 5995648, 6002793, 6005978, 6064388, 6067379, 6075881, 6137893, 6141033, 6157732, 6167150, 6215915, 6240208,
6240218, 6324299, 6381366, 6381375, 6408109, 6411734, 6421458, 6457032, 6459820, 6490375, 6516092, 6563324, 6658145, 6687402, 6690842,
6718074, 6748110, 6751361, 6771808, 6798925, 6804416, 6836567, 6850646, 6856698, 6920241, 6959112, 6975764, 6985625, 6993177, 6993192,
7006712, 7016539, 7043081, 7058225, 7065262, 7088862, 7164796, 7190834, 7242801, 7251366, EP0713593, JP3522280, JP3927239
VGR
5495537, 5602937, 5640200, 5768443, 5825483, 5850466, 5859923, 5949905, 5978080, 5995648, 6002793, 6005978, 6075881, 6137893, 6141033,
6157732, 6167150, 6215915, 6324299, 6381375, 6408109, 6411734, 6421458, 6457032, 6459820, 6490375, 6516092, 6563324, 6658145, 6690842,
6748110, 6751361, 6771808, 6804416, 6836567, 6850646, 6856698, 6959112, 6975764, 6985625, 6993192, 7006712, 7016539, 7043081, 7058225,
7065262, 7088862, 7164796, 7190834, 7242801, 7251366
OMNIVIEW
6215915, 6381375, 6408109, 6421458, 6457032, 6459820, 6594623, 6804416, 6959112, 7383536
SMD 4
5995648, 5850466, 6751361, 6690842, 6563324, 6490375, 5949905, 5978080, 6137893, 6167150, 6075881, 6748110, 5859923, 6411734, 6324299,
6516092, 7190834, 6658145, 6836567, 6850646, 6975764, 6985625, 6993192, 7006712, 7043081, 7058225, 7065262, 7088862, 7164796, 7251366,
6856698, 6002793, 6005978, 6771808, 6804416, 7016539, 6959112, 5602937, 7242801, 5640200, 5495537, 5768443, 5825483, 6421458, 6459820,
6215915, 6381375, 6457032, 6157732, 6408109, 6141033, 6026176, 6442291, 6151406, 6396942, 6614926, 5371690, 5845007, 5943441, 6963338,
5805722, 5909504, 5933523, 5964844, 5974169, 5987172, 6078700, 6252986, 6278796, 6307210, 6408429, 6424734, 6526165, 6571006, 6639624,
6681039, 6748104, 6813377, 6853751, 6898333, 6950548, 6993177, 7139421, 5757956
Wire Bonder
5495537, 5532739, 5581632, 5602937, 5640199, 5640200, 5642158, 5676302, 5754679, 5757956, 5768443, 5825483, 5835622, 5850466, 5859923,
5861909, 5949905, 5978080, 5991436, 5995648, 6002793, 6005978, 6035066, 6061467, 6075881, 6137893, 6141033, 6157732, 6167150, 6215915,
6289492, 6324299, 6381375, 6408109, 6411734, 6421458, 6457032, 6459820, 6490375, 6516092, 6563324, 6658145, 6690842, 6748110, 6751361,
6771808, 6804416, 6836567, 6850646, 6856698, 6959112, 6975764, 6985625, 6993192, 7006712, 7016539, 7043081, 7058225, 7065262, 7088862,
7164796, 7171036, 7190834, 7242801, 7251366
Other product and company names mentioned herein are the trademarks, or registered
trademarks, of their respective owners.
LASER LIGHT
DO NOT STARE INTO BEAM
CLASS 2 LASER PRODUCT 650 nm < 1 mW
CLASSIFIED PER IEC 60825-1, Ed 2. 2007-08
AS/NZS. 2211.1:2004
Scanning ............................................................................................................... 72
Handshaking ......................................................................................................... 73
Acquisition Sequence .............................................................................................. 74
Decode / Result Sequence ....................................................................................... 75
Results Buffering .................................................................................................... 75
SoftEvents ............................................................................................................ 76
String Commands .................................................................................................. 76
General Fault Indicator ........................................................................................... 77
Examples ................................................................................................................ 77
Function................................................................................................................ 77
Triggering a Read ................................................................................................ 78
Getting Read Results............................................................................................ 78
Execute String Commands (DMCC) ........................................................................ 79
Execute Soft Events ............................................................................................. 79
Modbus TCP ............................................................................................................. 81
DMCC ..................................................................................................................... 81
Reader Configuration Code ........................................................................................ 81
Setup Tool ............................................................................................................... 81
Modbus TCP Handler ................................................................................................. 82
Getting Started ........................................................................................................ 82
Network Configuration ............................................................................................ 83
Data Block Configuration ......................................................................................... 83
Interface ................................................................................................................. 84
Control Block ......................................................................................................... 84
Control Block Field Descriptions ............................................................................... 85
Status Block .......................................................................................................... 86
Status Block Field Descriptions ................................................................................ 86
Input Data Block .................................................................................................... 87
Input Data Block Field Descriptions .......................................................................... 88
Output Data Block .................................................................................................. 88
Output Data Block Field Descriptions ........................................................................ 88
String Command Block ........................................................................................... 88
String Command Block Field Descriptions .................................................................. 89
String Command Result Block .................................................................................. 89
String Command Result Block Field Descriptions ........................................................ 89
Operation ................................................................................................................ 89
Requests ............................................................................................................... 89
Typical Sequence Diagram ...................................................................................... 90
Handshaking ......................................................................................................... 90
Acquisition Sequence .............................................................................................. 90
Decode / Result Sequence ....................................................................................... 91
Results Buffering .................................................................................................... 92
SoftEvents ............................................................................................................ 92
String Commands .................................................................................................. 93
General Fault Indicator ........................................................................................... 93
Examples ................................................................................................................ 94
ApplicationLayer Example ....................................................................................... 94
Function................................................................................................................ 94
Transferring “Control” Register Data ...................................................................... 94
Transferring Status Register Data .......................................................................... 95
Transferring Output Data ...................................................................................... 95
DataManControl Example ........................................................................................ 95
Function................................................................................................................ 95
Triggering a Read ................................................................................................ 95
Getting Read Results............................................................................................ 96
Execute String Commands (DMCC) ........................................................................ 96
Execute Soft Events ............................................................................................. 96
PROFINET ................................................................................................................ 97
DMCC ..................................................................................................................... 97
Reader Configuration Code ........................................................................................ 97
Setup Tool ............................................................................................................... 98
Getting Started ........................................................................................................ 98
Modules ................................................................................................................. 103
Acquisition Control Module ................................................................................... 104
Acquisition Status Module .................................................................................... 105
Results Control Module ........................................................................................ 105
Results Status Module ......................................................................................... 106
Soft Event Control Module ................................................................................... 106
User Data Module ............................................................................................... 107
Result Data Module ............................................................................................. 108
Operation ............................................................................................................... 109
SoftEvents ........................................................................................................... 109
Networking
You can connect your DataMan via a simple Ethernet connection. You can either set the IP
address and subnet mask of your DataMan manually or let them be configured
automatically using DHCP.
Ethernet connection
3. The base station becomes visible as connected through Ethernet, and it routes data
through the wireless interface to the reader.
c. Enter an IP Address and Subnet Mask that will be on the same subnet as the PC.
Make sure this IP address is not yet in use (for example, test by pinging it).
NOTE
The default Subnet Mask is 255.255.255.0. You can set it back to default by scanning the
Reset Scanner to Factory Defaults Configuration Code.
Authentication should be left blank unless Authentication has been enabled on the
DataMan. Authentication is disabled by default.
Click OK. Your DataMan is configured to the network settings specified, and it
reboots automatically.
Your DataMan appears under the Network devices node after the address has
been resolved. This can take up to 60 seconds.
8. If the device does not appear after 1 or 2 minutes, push the Refresh button on the
Setup Tool‟s Connect to Reader pane. This will force the Setup Tool to scan for
DataMan devices connected to the PC or connected to the same network.
You can check (and configure) the Static IP Address of both the wireless reader and the
base station under Communication Settings when you connect to the base station in the
Setup Tool.
Once the IP Address and Subnet Mask of the DataMan are known, the PC‟s network
settings can be changed.
11. Under the General tab, scroll down and select Internet Protocol (TCP/IP), and
click Properties.
12. Under the General tab, select the Use the following IP address radio option and
enter an IP Address and Subnet Mask that are on the same subnet as your DataMan.
Click OK.
13. Click Close. The network settings of your PC will change to the new specified
values.
14. Reboot the DataMan. It appears under the Network devices node on the Connect
to Reader pane after the network address has been resolved.
15. If the device does not appear after 1 or 2 minutes, click the Refresh button on the
Setup Tool‟s Connect to Reader pane. The Setup Tool scans for DataMan devices
connected to the PC or connected to the same network.
2. Enter a name and the actual IP Address of the target DataMan. The name has no
effect upon the DataMan. It is only used as an identifier to list the target DataMan
under the Network devices node.
3. Click OK. The name appears under the Network devices node. Double click the
new node or highlight it and click the Connect button. If the device is available,
you will be connected (a DataMan 200 is connected in this example).
EtherNet/IP
DataMan supports EtherNet/IP™, an application level protocol based on the Common
Industrial Protocol (CIP). EtherNet/IP provides an extensive range of messaging options
and services for the transfer of data and I/O over Ethernet. All devices on an EtherNet/IP
network present their data to the network as a series of data values called attributes.
Attributes can be grouped with other related data values into sets, these are called
Assemblies.
By default the DataMan has the EtherNet/IP protocol disabled. The protocol can be enabled
via DMCC, scanning a reader programming code, or in the Setup Tool.
DMCC
The following commands can be used to enable/disable EtherNet/IP on the DataMan. The
commands may be issued via RS-232 or Telnet connection.
NOTE
Because you have to make changes to the Telnet client provided by Windows to
communicate with DataMan, it is recommended you use third party clients such as PuTTY.
Enable:
||>SET ETHERNET-IP.ENABLED ON
||>CONFIG.SAVE
||>REBOOT
Disable:
||>SET ETHERNET-IP.ENABLED OFF
||>CONFIG.SAVE
||>REBOOT
Setup Tool
EtherNet/IP can be enabled by checking Enabled on the Industrial Protocols pane‟s
EtherNet/IP tab. Make sure you save the new selection by clicking Yes to the Reboot
Required message window.
NOTE
The new settings take effect only after the reader is rebooted.
Getting Started
Preparing to use EtherNet/IP involves the following main steps:
Make sure you have the Rockwell Software tool on your machine.
Set up the Rockwell Software tool so that it recognizes your DataMan device.
Install the DataMan Electronic Data Sheet (EDS) for the DataMan reader.
Perform the following steps to set up EtherNet/IP:
1. Verify that the Rockwell Software is on your PC.
2. Make sure you select the Add on Profile installation and the Samples installation. Add
on Profile is only used with Rockwell ControlLogix or CompactLogix PLCs.
3. Install the Rockwell Add on Profiles by navigating to the following directory.
NOTE
Adjust the path for the specific Setup Tool version that you are using.
In the Setup Tool, go to the Industrial Protocols pane and check the Enabled
checkbox on the EtherNet/IP™ tab.
10. In order for the changes to take effect, you must save your settings and cycle power.
In the Setup Tool menu, click System Save Settings.
11. Reboot your reader.
12. Your DataMan is visible now in the RSWHO.
If your DataMan is visible, but the icon is a question mark, repeat the EDS Installation.
13. Open one of the sample jobs and integrate your DataMan into your program using the
Add on Profile.
14. Alternatively, you can add the DataMan as a Module on your network.
Object Model
The ID Reader Object is a vendor specific object class. This means it is not part of the CIP
common (public) architecture but rather an extension. It is a custom object that Cognex
has added to the EtherNet/IP architecture on the DataMan device. This object models all
data and functionality available in the DataMan reader. This includes triggering, status,
events, errors and result data.
The ID Reader Object is identified by its vender specific class code:
DataMan ID Reader Object Class Code: 0x79
Objects are made up of attributes (data) and services (functionality). These can be defined
at the class level (common to all instances of the class) or the instance level (unique to an
individual instance). There are common attributes and services defined by the CIP
specification that apply to all objects (often these are optional). Vendors may also define
their own attributes and services for their vendor specific classes.
The ID Reader Object attributes and services can be individually accessed via explicit
messaging. Also a number of the ID Reader Object attributes are exposed in the DataMan
assembly objects which allow them to be accessed as a group via implicit messaging.
Other
Identity Ethernet TCP/IP
Internal
Object Link Object Object
Objects
Assembly Object
Reader
Instance 11 Instance 21
Object Inputs Outputs
Attributes
The DataMan ID Reader Object (Class Code: 0x79) has the following attributes.
SoftEvents
SoftEvents act as “virtual” inputs. When the value of a SoftEvent changes from 0 1 the
action associated with the event will be executed. When the action completes the
corresponding SoftEventAck bit will change from 1 0 to signal completion.
The SoftEvent and SoftEventAck form a logical handshake. After SoftEventAck changes to 1
the original SoftEvent should be set back to 0. When that occurs SoftEventAck will
automatically be set back to 0.
The “ExecuteDMCC” and “SetMatchString” soft event actions require user supplied data.
This data must be written to the UserData & UserDataLength area of the Input Assembly
prior to invoking the soft event. Since both of these soft events depend on the UserData,
only one may be invoked at a time.
SoftEvent
SoftEventAck
GeneralFault
Services
The ID Reader Object supports the following Common CIP services.
Acquire Service
The Acquire Service will cause an acquisition to be triggered (if the acquisition system is
ready to acquire an image). If the acquisition could not be triggered, then the Missed
Acquisition bit of the AcqStatusRegister will be set until the next successful acquisition.
SendDMCC Service
The SendDMCC Service sends a DMCC command string to the device. The request data
consists of the DMCC command string that is to be sent to the reader. The reply data will
contain the string result of the DMCC command. Additionally the service provides a numeric
result status for the call. Most of these result codes relate to the basic success/failure of
the service execution. However, the service also maps the actual DMCC status codes. This
allows the PLC to interpret the service request without having to parse the actual DMCC
return string.
0 Success – No error 0
1 Bad Command -
NOTE
GetDecodeResults Service
The GetDecodeResults service reads data from the DecodeResults attribute of the ID
Reader Object. This service takes parameters indicating the “size” (number of bytes to
read) and the “offset” (offset into the DecodeResults attribute to begin reading). This gives
the service the flexibility to be used with PLC‟s that have different restrictions on the
amount of data allowed in an explicit message. It also allows the user to access very large
codes that cannot be completely transferred with implicit messaging (assembly object).
The offset into the DecodeResults attribute. This specifies the first
Offset UINT byte of the DecodeResults attribute to begin reading (0 based
offset).
Acquisition Sequence
DataMan can be triggered to acquire images by several methods. It can be done implicitly
via the Assembly object. Or done explicitly via the ID Reader object. When using explicit
messaging it can be done in a single step by accessing the Acquire Service, it can also be
done by directly manipulating the ID Reader object attributes (AcqTrigger and
AcqStatusRegister) and finally it can be done via DMCC command. The ID Reader attributes
will be discussed here but these same values can be accessed via the assembly objects.
On startup the AcqTriggerEnable attribute will be False. It must be set to True to enable
triggering. When the device is ready to accept triggers, the Trigger Ready bit in the
AcqStatusRegister will be set to True.
While the AcqStatusRegister “Trigger Ready” bit is True, each time the ID Reader object
sees the AcqTrigger attribute change from 0 to 1, it will initiate an image acquisition. When
setting this via the assembly objects, the attribute should be held in the new state until
that same state value is seen in the Trigger Ack bit of the AcqStatusRegister (this is a
necessary handshake to guarantee that the change is seen by the ID Reader object).
During an acquisition, the Trigger Ready bit in the AcqStatusRegister will be cleared and
the Acquiring bit will be set to True. When the acquisition is completed, the Acquiring bit
will be cleared. The Trigger Ready bit will again be set True once the device is ready to
begin a new image acquisition.
If results buffering is enabled, the device will allow overlapped acquisition and decoding
operations. Trigger Ready will be set high after acquisition is complete but while decoding
is still in process. This can be used to achieve faster overall trigger rates. If result buffering
is not enabled, the Trigger Ready bit will remain low until both the acquisition and decode
operations have completed.
As a special case, an acquisition can be cancelled by clearing the Trigger signal before the
read operation has completed. This allows for the cancellation of reads in Presentation and
Manual mode if no code is in the field of view. To ensure that a read is not unintentionally
Trigger EN
Trigger Ready 1 2 3
1 2 3
Trigger 1 2 M 3
1 2 M 3
Trigger Ack
1 1 2
2
M
M
3
3
Acquiring 1 2 3
2 3
1
Missed Acq M
M
Acquisition #1 Acquisition #2 Missed Acq Acquisition #3
Client
DataMan
To force a reset of the trigger mechanism set the AcqTriggerEnable attribute to False, until
the AcqStatusRegister is 0. Then, AcqTriggerEnable can be set to True to re-enable
acquisition.
Behavior of DecodeStatusRegister
Bit Bit Name Results if Buffering Disabled Results if Buffering Enabled
Set when new results are Set when new results are
placed in the DecodeResults placed in the DecodeResults
attribute. Stays set until the attribute. Stays set until the
4 Results Available
results are acknowledged by results are acknowledged by
setting DecodeResultsAck to setting DecodeResultsAck to
true. true.
Trigger 1 2
Ready 1 2
Trigger 1
1 2
Trigger 1 2
Ack 1 2
Acquiring 1 2
1 2
Decoding 1 2
1 2
Decode 1 22
Cmplt 1
Results 1 2
Avail 1 2
Results 1 h
Ack 1 2t
t
Read #2 p
Read #1
:
Client
/
DataMan /
w
w
w
Results Buffering .
f
There is an option to enable a queue for decode results. If enabled this allows a finite
a
number of decode result data to queue up until the client (PLC) has time to read them. This
c
is useful to smooth out data flow if the client (PLC) slows down for short periods of time.
e
Also, if result buffering is enabled the device will allow overlapped acquisition and decode b
operations. Depending on the application this can be used to achieve faster over all trigger o
rates. See Acquisition Sequence description above for further detail. o
k
In general, if reads are occurring faster than results can be sent out the primary difference
.
between buffering or not buffering is determining which results get discarded. If buffering c
o
m
DataMan® Communications and Programming Guide /
12/2/2011 | Version 4.2 a
P a g e | 31 l
b
EtherNet/IP
is not enabled the most recent results are kept and the earlier result (which was not read
by the PLC fast enough) is lost. Essentially the more recent result will simply over write the
earlier result. If buffering is enabled (and the queue becomes full) the most recent results
are discarded until room becomes available in the results queue.
Assembly Object
Assemblies are combinations of selected attributes (data items) from CIP objects with in a
device. The device vendor defines assemblies according to their needs. They combine data
together in useful groupings according to the requirements of the application.
The designation of Input & Output assembly can be confusing. DataMan is an I/O adapter
class device. The convention for adapters is that Input Assemblies produce (transmit) data
for another device (i.e. DataMan PLC) and Output Assemblies consume (receive) data
from another device (i.e. PLC DataMan). Essentially DataMan acts as an I/O module for
another device such as a PLC.
Assembly objects use implicit messaging. In the abstract they are just blocks of data which
are transmitted as the raw payload of implicit messaging packets. These implicit messaging
packets are produced (transmitted) repeatedly at a predefined chosen rate (100ms,
200ms, etc).
DataMan readers have a single input assembly and single output assembly. These
assemblies combine selected attributes (data) of the DataMan ID Reader Object into
groupings that minimize network bandwidth and still allow for efficient control and
processing. The data in these assemblies can also be accessed individually from the ID
Reader Object. However, using the assembly objects is much more efficient. This is the
reason that they are the primary means of runtime communication between a DataMan
reader and a PLC.
Input Assembly
The Input assembly provides status information, process state, and decode results.
Instance Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Results Decode
General Results
1 Reserved Buffer Complete Decoding
Fault Available
Overrun Toggle
3-5 Reserved
6
Trigger ID (16-bit integer)
7
8
Result ID (16-bit integer)
9
Instance Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
11
12
Result Extended (16-bit integer)
13
14
Result Data Length (16-bit integer)
15
16 Result Data 0
Output Assembly
The Output assembly contains control signals, software event signals, and any user data
required for the trigger & decode.
Instance Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
21 Buffer
Results Trigger
0 Reserved Results Trigger
Ack Enable
Enable
2
Reserved
3
4
User Data Option (16-bit integer)
5
6
User Data Length (16-bit integer)
7
8 User Data 0
PCCC Object
DataMan has limited support for the Rockwell PCCC object. This allows legacy PLC‟s (PLC-5,
SLC, etc) to communicate with DataMan using their native PCCC command set and explicit
messaging. The PCCC object allows DataMan to look like a Rockwell PLC-5 logic controller.
PCCC commands are organized to work with “data tables” that exist in legacy logic
controllers. Each data table is an array of a give data type (BYTE, INT, FLOAT, etc). The
commands are oriented to read/write one or more data items of a given data table. Items
are addressed by specifying the data table and the index of the item in the table (indexes
base from 0). For instance to read the 6th integer in PLC data table you would send the
PCCC command to read N7:5. “N” specifies an integer table, “7” is the table number in the
The ResultCode value is located at word offset 5 (counting from 0) of the Input Assembly.
To access this value you would issue the following PLC command.
Word 0 Word 0
PCCC Read 1 Word 11 Word
Word11
Word
element @ “N7:5”
... ...
Word 5 Word 5
Word 6 Word 6
Word 7 Word 7
... ...
Word n Word n
The decode ResultData begins at byte offset 16 (counting from 0) of the Input Assembly.
To read the first 4 bytes of result data you would issue the following PLC command.
Byte 0 Byte 0
PCCC Read 4
Word
Byte 1 1 Byte 1
elements @ “A9:16”
... ...
Byte 16 Byte 16
Byte 17 Byte 17
Byte 18 Byte 18
Byte 19 Byte 19
... ...
Byte n Byte n
Word 0 Word 0
PCCC Write 4
Word
... 1 ...
elements @ “N7:4”
Word 4 Word 4
Word 5 Word 5
Word 6 Word 6
Word 7 Word 7
Word 8 Word 8
... ...
Word n Word n
The bit to trigger an acquisition is in byte offset 0 of the Output Assembly. To write to this
byte you would issue the following PLC command.
The PCCC Object supports a special case mapping of a string table element (ST10:0) to the
DMCC service. Any string written to ST10:0 will be passed to the DMCC service for
processing. This allows PCCC write string commands to be used to invoke DMCC
commands.
NOTE
The string table is only one element in size. Writing to the other elements will return an
error.
Implicit Messaging
EtherNet/IP implicit messaging allows a DataMan reader‟s inputs and outputs to be mapped
into tags in the ControlLogix PLC. Once these connections are established the data is
transferred cyclically at a user defined interval (10ms, 50ms, 100ms, etc).
The figure below represents Ethernet-based I/O through EtherNet/IP:
Input
DataMan:I
Assembly
ID Reader
Object
Output
DataMan:O
Assembly
The Input Assembly and Output Assembly map various attributes (data) from the ID
Reader object: The Input Assembly is the collection of DataMan reader data values sent to
the PLC (PLC inputs); and the Output Assembly is the collection of data values received by
the DataMan reader from the PLC (PLC outputs).
2. From the Select Module dialog, choose your model of DataMan ID Reader from the list.
NOTE
This option will only be available after the DataMan Add-On Profile has been installed.
NOTE
The remainder of the steps is identical regardless of which DataMan model is selected.
3. After the selection is made, the configuration dialog for the DataMan ID Reader system
will be displayed. Give the module a name and enter the DataMan‟s IP address. The
default is a bidirectional (send/receive) connection consisting of control, status, and 32
bytes of result data with keying disabled. To change this default connection, select the
“Change…” button. If no change is required skip over the next step.
Electronic Keying: Defines the level of module type checking that is performed by the
PLC before a connection will be established.
Exact Match – All of the parameters must match or the connection will be rejected.
Vendor
Output Data to Sensor: Defines the amount of data transmitted on the connection (to the
DataMan). The minimum amount is the Control data only. The connection can be
configured to also send user data. The amount of user data sent is defined in fixed
increments (16 bytes, 32 bytes, 64 bytes etc).
5. The final step is configuring the connection rate. The rate at which data is
transmitted/received is defined as the Requested Packet Interval (RPI). The RPI
defines how frequently the data is transmitted/received over the connection. To
optimize network performance this rate should be set no lower than absolutely
required by a given application. In general it should be set no lower than ½ the
expected maximum read rate of the user application. Setting it lower wastes
bandwidth and does not improve processing performance.
6. Select the “Connection” tab of the “New Module” dialog to set the rate.
7. After adding the module to ControlLogix, the I/O tree should appear as follows:
8. When the DataMan module is added to the I/O tree RSLogix 5000 creates tags that
map to the DataMan reader Input and Output Data (i.e. the Input & Output Assembly
Objects in the DataMan Reader). These tags can be found under the “Controller Tags”
node of the project tree.
NOTE
The base name of these tags is the name you gave to the DataMan Module that you added
to the I/O Configuration in the earlier steps.
TriggerReady: Indicates when the DataMan reader can accept a new trigger. This tag
is True when the Control tag “TriggerEnable” has been set and the sensor is not
currently acquiring an image.
TriggerEnable: Setting this tag enables EtherNet/IP triggering. Clearing this field
disables the EtherNet/IP triggering.
Trigger: Setting this tag triggers an acquisition when the following conditions are
met:
The TriggerEnable tag is set.
ResultsBufferEnable: When set, the decode results will be queued. Results are
pulled from the queue (made available) each time the current results are
acknowledged. until acknowledged by the PLC. The Decode ID, Decode Result and
Decode ResultsData fields are held constant until the DecodeResultsAck field has
acknowledged them and been set. The DataMan reader will respond to the
acknowledgement by clearing the ResultsValid bit. Once the DecodeResultsAck field is
cleared the next set of decode results will be posted.
ResultsAck: The ResultsAck tag is used to acknowledge that the PLC has read the
latest results. When ResultsAck is set, the ResultsAvailable tag will be cleared. If
results buffering is enabled the next set of results will be made available when the
ResultsAck tag is again cleared.
TrainCode: Changing this tag from 0 to 1 will cause the train code operation to be
invoked.
TrainMatchString: Changing this tag from 0 to 1 will cause the train match string
operation to be invoked.
TrainFocus: Changing this tag from 0 to 1 will cause the train focus operation to be
invoked.
To verify the correct, 2-way transfer of I/O data, in RSLogix, go to the controller tags and
change the state of the TriggerEnable bit from 0 to 1:
Explicit Messaging
Unlike implicit messaging, explicit messages are sent to a specific device and that device
always responds with a reply to that message. As a result, explicit messages are better
suited for operations that occur infrequently. Explicit messages can be used to read and
write the attributes (data) of the ID Reader Object. They may also be used for acquiring
images, sending DMCC commands and retrieving result data.
4. On the MSG instruction “Communication” tab, browse for and select the DataMan
which you added to the project I/O Configuration tree. This tells Logix where to send
the explicit message.
From the “Select Module” dialog, choose your model of DataMan ID Reader from the list.
After the selection is made, the configuration dialog for the DataMan ID Reader system will
be displayed. From this point on configuration and programming are done exactly as shown
in the ControlLogix section above.
Size in Elements: This is the number of elements (or individual data) to send. In this
example, two elements are being sent (3.14 and 78.87).
Channel: Depends on the configuration of the SLC. In the SLC, Channel 1 is the
Ethernet port.
Target Device section:
Message Timeout: Choose an appropriate length of time in which the DataMan
reader will be able to respond. If the DataMan does not respond within this length of
time, the MSG instruction will error out. This parameter cannot be changed from this
screen. Message Timeout is determined by the parameters entered in the Channel 1
setup dialog.
4. Add a new Message (MSG) instruction to your ladder logic and configure it as shown in
the following example:
Data Table
ST10:0 First element from the String Table (ST) created above
Address
Data Table This is the destination address. For DMCC commands, this
ST10:0
Address will always be ST10:0
6. Click the MultiHop tab and configure it as required (i.e. set IP address of DataMan).
7. When everything is configured, close the MSG window.
8. Save your ladder logic, download it to the controller, then go online and set the
controller in RUN mode.
9. Trigger the message to send it to the DataMan reader.
The Enable (EN) bit of the message instruction will be set to 1 when the input to the
instruction is set high. The Done (DN) bit will be set to 1 when DataMan has replied that
the DMCC command was received and executed with success. If the Error bit (ER) is
enabled (set to 1), there has been a problem with the message instruction. If an error
occurs, click the Setup Screen for the MSG instruction. The Error Code will be shown at the
bottom of the window.
4. After the selection is made, the configuration dialog for the Generic Ethernet Module
will be displayed. Configure the following:
Give the module a name.
Enter your DataMan‟s IP address.
Set the Comm Format to “Data – INT”. This tells the module to treat the data as an
array of 16-bit integers.
Input Assembly: Set instance 11. Set the size to the amount of Input Assembly data
you want the PLC to receive. Basic “Status” data requires 8 integers. The amount
beyond that will be the actual decode result data. In the example below the size is set
to 24 (8 for status + 16 for result data). This connection will receive the status info
plus 32 bytes of result data.
Output Assembly: Set instance 21. Set the size to 4 integers. This size is sufficient to
send all required “Control” data to the DataMan.
Configuration Assembly: Set instance 1. Set size to zero (no used).
5. The final step is configuring the connection rate. The rate at which data is
transmitted/received is defined as the Requested Packet Interval (RPI). The RPI
defines how frequently the data is transmitted/received over the connection. To
optimize network performance this rate should be set no lower than absolutely
required by a given application. In no case should it be set to lower than ½ the
median scan rate of the PLC ladder program. Setting it lower wastes bandwidth and
does not improve processing performance.
6. After adding the generic module to ControlLogix, the I/O tree should appear as
follows.
The tags are organized in three groups: Config “MyDM200:C”, Input “MyDM200:I”, and
Output “MyDM200:O”. You can ignore the Config tags (no used). The Input tags represent
all the data being received (from the DataMan). The Ouput tags represent all the data
being sent (to the DataMan).
These tags are the data table representation of the DataMan Assembly Object contents.
The PLC ladder is written to access these tag values. By monitoring or changing these tag
values the PLC ladder is actually monitoring and changing the DataMan Assembly Object
contents.
NOTE
There is a time delay between the DataMan and these PLC tag values (based on the
configured RPI). All PLC ladder must be written to take that time delay into account.
Input Assembly “ResultLength”: Word 7 of the Input Assembly. From the Input tag array
for the DataMan select word 7.
Output Assembly “Trigger”: Bit 1 of word 0 of the OutputAssembly. From the Output tag
array for the DataMan select bit 1 of word 0.
MC Protocol
The MC Protocol uses standard Ethernet hardware and software to exchange I/O data,
alarms, and diagnostics. It is Mitsubishi Electric‟s publicly available, standardized
communication format for communicating with Q, iQ and L Series PLCs through Ethernet or
serial connections. DataMan supports MC Protocol on Ethernet only.
By default the DataMan has MC Protocol disabled. The protocol can be enabled in the Setup
Tool, via DMCC, or by scanning a parameter code.
DMCC
The following commands can be used to enable/disable MC Protocol. The commands can be
issued via RS-232 or Telnet connection.
NOTE
Because you have to make changes to the Telnet client provided by Windows to
communicate with DataMan, it is recommended you use third party clients such as PuTTY.
Enable:
||>SET MC-PROTOCOL.ENABLED ON
||>CONFIG.SAVE
||>REBOOT
Disable:
||>SET MC-PROTOCOL.ENABLED OFF
||>CONFIG.SAVE
||>REBOOT
NOTE
You must reboot the device for the change to take effect.
Setup Tool
MC Protocol can be enabled by checking Enabled on the Industrial Protocols pane‟s MC
Protocol tab. Make sure you save the new selection by clicking Yes to the Reboot Required
message window.
NOTE
You must reboot your reader for the new settings to take effect.
MC Protocol Scanner
MC Protocol on DataMan is implemented as a client type device also referred to as a
scanner. All communication is initiated by the DataMan reader in the form of read and write
requests. The PLC acts as a passive server reacting to the read and write requests. Since
the PLC cannot initiate communication it relies on the reader to periodically ask (scan) the
PLC for any actions or information that the PLC requires (such as triggering or retrieving
read results).
Getting Started
By default, MC Protocol is not enabled on the DataMan reader. The protocol must be
enabled and the protocol configuration parameters must be set to correctly interact with a
PLC. Protocol configuration is accomplished via the DataMan Setup Tool.
1. From the Windows Start menu, start the Setup Tool.
2. Under Communication Settings, click the Industrial Protocols node.
3. Select the MC Protocol tab.
Network Configuration
The network configuration defines all the information that the DataMan reader needs to
establish a connection with a PLC.
Host Port Any Hex port number Port number of the MC Protocol
3000
(Hex) 1000-FFFF channel on the PLC
Interface
This section describes the interface to the DataMan reader as seen by the PLC via MC
Protocol. The interface model consists of 6 data blocks grouped in 3 logical pairs:
Control and Status
Input Data and Output Data
String Command and String Response
Not all of the blocks are required. You may select which blocks are appropriate for your
particular application. However, Control and Status will generally be included for most
applications.
You can define the starting address and device type for each interface block that you
choose to use in your application. Undefined blocks will not be exchanged. For any transfer
(read or write) the entire block is sent, even if only one field within the block has changed
value. The protocol implementation will minimize network use by grouping as many value
changes as logically possible into a single transfer.
Control Block
The Control block contains bit type data. However, the block may be defined to exist in
either bit or word memory in the PLC. This block consists of the control signals sent from
the PLC to the reader. It is used by the PLC to initiate actions and acknowledge certain data
transfers.
Operation
MC Protocol is a command/response based protocol. All communications are originated
from the DataMan reader. The reader must send read requests to the PLC at a periodic
interval to detect changes in the control bits.
Scanning
To initiate actions or control data transfer, the PLC changes the state of certain bits of the
Control block. Since only the reader can initiate communications, the reader scans (that is,
reads the Control block from the PLC) at a periodic rate. This rate is defined by the user.
After each scan, the reader will process changes in state of the bits in the Control block.
Some state changes require additional communications with the PLC, such as writing
updated acknowledge bit values or reading a new string command. These additional
communications are handled automatically by the reader. Other state changes initiate
DataMan PLC
Write (Status)
Acquiring
Write (Status)
Decoding
Handshaking
A number of actions are accomplished by means of a logical handshake between the reader
and PLC (triggering, transferring results, executing soft events, string commands, and so
on). This is done to ensure that both sides of a transaction know the state of the operation
on the opposite side. Network transmission delays will always introduce a finite time delay
in transfer data and signals. Without this handshaking, it is possible that one side of a
transaction might not detect a signal state change on the other side. Any operation that
has both an initiating signal and corresponding acknowledge signal will use this basic
handshake procedure.
The procedure involves a four-way handshake.
1. Assert signal
2. Signal acknowledge
Acquisition Sequence
DataMan can be triggered to acquire images by several methods. It can be done via the MC
Protocol by setting the Trigger bit or issuing a trigger String Command. It can also be done
via DMCC command (Telnet) or hardwired trigger signal. The Trigger bit method will be
discussed here.
On startup the TriggerEnable will be False. It must be set to True to enable triggering via
the MC Protocol Trigger bit. When the device is ready to accept triggers, the reader will set
the TriggerReady bit to True.
While the TriggerReady bit is True, each time the reader detects the Trigger bit change
from 01, it will initiate a read. The Trigger bit should be held in the new state until that
same state value is seen in the TriggerAck bit (this is a necessary handshake to guarantee
that the trigger is seen by the reader).
During an acquisition, the TriggerReady bit will be cleared and the Acquiring bit will be set
to True. When the acquisition is completed, the Acquiring bit will be cleared. When the
device is ready to begin another image acquisition, the TriggerReady bit will again be set to
True.
If results buffering is enabled, the reader will allow overlapped acquisition and decoding
operations. TriggerReady will be set high after acquisition is complete but while decoding is
still in process. This can be used to achieve faster overall trigger rates. If result buffering is
not enabled, the TriggerReady bit will remain low until both the acquisition and decode
operations have completed.
Trigger EN
Trigger Ready 1 2 3
1 2 3
Trigger 1 2 M 3
1 2 M 3
Trigger Ack
1 1 2
2
M
M
3
3
Acquiring 1 2 3
2 3
1
Missed Acq M
M
Acquisition #1 Acquisition #2 Missed Acq Acquisition #3
PLC
DataMan
Trigger 1 2
Ready 1 2
Trigger 1
1 2
Trigger 1 2
Ack 1 2
Acquiring 1 2
1 2
Decoding 1 2
1 2
Decode 1 22
Cmplt 1
Results 1 2
Avail 1 2
Results 1 h
Ack 1 2t
t
Read #2 p
Read #1
:
PLC
/
DataMan /
w
w
w
Results Buffering
.
There is an option to enable a queue for read results. If enabled, this allows a finite number
f
of sets of result data to be queued up until the PLC has time to read them. This is useful to
a
smooth out data flow if the PLC slows down for short periods of time.
c
e
b
o
o
k
DataMan® Communications and Programming Guide
.
12/2/2011 | Version 4.2
c
P a g e | 75 o
m
MC Protocol
Also, if result buffering is enabled the reader will allow overlapped acquisition and decode
operations. Depending on the application this can be used to achieve faster overall trigger
rates. See Acquisition Sequence description above for further detail.
In general, if reads are occurring faster than results can be sent out, the primary difference
between buffering or not buffering determines which results get discarded. If buffering is
not enabled, the most recent results are kept and the earlier result (which was not read by
the PLC quickly enough) is lost. The more recent result will overwrite the earlier result. If
buffering is enabled (and the queue becomes full) the most recent results are discarded
until room becomes available in the results queue.
SoftEvents
SoftEvents act as “virtual” inputs. When the value of a SoftEvent bit changes from 0 1
the action associated with the event will be executed. When the action completes, the
corresponding SoftEventAck bit will change from 0 1 to signal completion.
The SoftEvent and SoftEventAck form a logical handshake. After SoftEventAck changes to
1, the original SoftEvent should be set back to 0. When that occurs, SoftEventAck will
automatically be set back to 0.
NOTE
Do not execute soft events that change the reader configuration at the same time that
reads are being triggered. Changing configuration during acquisition/decode can lead to
unpredictable results.
The “ExecuteDMCC” and “SetMatchString” soft event actions require user supplied data.
This data must be written to the UserData and UserDataLength area of the Input Data
block prior to invoking the soft event. Since both of these soft events depend on the
UserData, only one may be invoked at a time.
String Commands
The DataMan MC Protocol implementation includes a String Command feature. This feature
allows you to execute string-based DMCC commands over the MC protocol connection. The
DMCC command is sent to the reader via the String Command block. The DMCC command
result is returned via the String Command Result block. Initiating a command and
notification of completion is accomplished by signaling bits in the Control and Status blocks.
To execute a DMCC command, the command string is placed in the data field of the String
Command block. The command string consists of standard ASCII text. The command
format is exactly the same as would be used for a serial (RS-232) or Telnet connection.
The string does not need to be terminated with a null character. Instead, the length of the
string (that is, the number of ASCII characters) is placed in the length field of the String
Command block.
After executing the DMCC command, the result string is returned in the String Command
Result block. Similar to the original command, the result string consists of ASCII characters
in the same format as would be returned via serial or Telnet. Also, there is no terminating
null character. Instead the length of the result is returned in the Command String Result
length field. The Command String Result block also contains a numeric result code. This
allows you to determine the success or failure of the command without having to parse the
text string. The values of the result code are defined in the DMCC documentation.
SoftEvent
SoftEventAck
GeneralFault
Examples
Included with the Setup Tool installer is an example PLC program created with Mitsubishi
(GX Works2) software. This simple program clearly demonstrates DataMan ID readers‟
capabilities and proper operation. The same operations can be achieved by using more
advanced features and efficient programming practices with Mitsubishi PLCs. However,
such an advanced program is less useful for demonstration purposes.
Function
The example application demonstrates the following operations:
1. Triggering a read
2. Getting read results
3. Executing string commands (DMCC)
4. Executing soft event operations
a. Train code
c. Train focus
d. Train brightness
e. Un-train
f. Execute DMCC
The “Main” program contains a PLC ladder rung to invoke each of these operations. The
operation is invoked by toggling the control bit on the rung from 0 1. This will invoke the
associated subroutine to perform the operation. When the operation is complete, the
subroutine will set the control bit back to 0.
Triggering a Read
The example provides two trigger options; “Continuous Trigger” and “Single Trigger”. As
the name implies, enabling the “Continuous Trigger” bit will invoke a continuous series of
read operations. Once enabled, the “Continuous Trigger” control bit will remain set until
you disable it. The “Single Trigger” control bit invokes a single read operation. This control
bit will automatically be cleared when the read is completed.
Primarily, the trigger subroutine manages the trigger handshake operation between the
PLC and the reader. The control Trigger bit is set, the PLC waits for the corresponding
TriggerAck status bit from the reader, and the control Trigger bit is reset. Refer to a
description of handshaking in Section Operation.
The trigger subroutine contains a delay timer. This is not required for operation. It exists
simply to add an adjustable artificial delay between reads for demonstration purposes.
For this example the operation of triggering a read and getting read results was
intentionally separated. This is to support the situation where the PLC is not the source of
the read trigger. For example, the reader may be configured to use a hardware trigger. In
such a case, only the get results subroutine would be needed.
Like the triggering subroutine, the get results subroutine manages the results handshake
operation between the PLC and the reader. However, it also copies the result data to
internal storage. The routine waits for the ResultsAvailable status bit to become active, it
copies the result data to internal storage, and then executes the ResultsAck handshake.
Refer to a description of handshaking in Section Operation.
The read result consists of a ResultCode, ResultLength, and ResultData. Refer to Section
Output Data Block Field Descriptions for details of the ResultCode values. The ResultLength
field indicates how many bytes of actual result data exist in the ResultData field. The
subroutine converts this byte length to word length before copying the results to internal
storage.
The get results subroutine gathers read statistics (number of good reads, number of no-
reads, and so on). This is not required for operation. It is simply for demonstration
purposes.
The string command feature provides a simple way to invoke DMCC commands from the
PLC. The command format and command result format is exactly identical to that used for
serial or Telnet DMCC operation.
This subroutine copies an example DMCC command (||>GET CAMERA.EXPOSURE) to the
String Command block and then manages the string command handshake operation
between the PLC and the reader to invoke the command and retrieve the command result.
Any valid DMCC command may be invoked with this mechanism. Refer to the DataMan
Command Reference document available through the Windows Start menu.
The “Execute DMCC” and “Set Match String” soft events make use of the Input Data block.
The subroutine for these two events copies the relevant data into the User Data fields of
the Input Data block and then invokes the User Data subroutine to transfer the data to the
reader. Only after the user data is transferred is the actual soft event action invoked. It is
required that the user data be transferred before invoking either of these events.
NOTE
The “Train Match String” soft event only prepares the training mechanism. The actual
training occurs on the next read operation. Therefore, a trigger must be issued following
“Train Match String”.
Modbus TCP
Modbus is an application layer protocol. It provides client/server communication between
devices connected to different types of buses or networks. Modbus is a request/response
protocol, whose services are specified by using function codes.
Modbus TCP provides the Modbus protocol using TCP/IP. System port 502 is reserved for
Modbus communication. It uses standard Ethernet hardware and software to exchange I/O
data and diagnostics. DataMan provides Modbus TCP server functionality only.
By default, DataMan has the Modbus TCP protocol disabled. The protocol can be enabled in
the Setup Tool, via DMCC, or by scanning a parameter code.
DMCC
The following commands can be used to enable/disable Modbus TCP. The commands can be
issued via RS-232 or Telnet connection.
NOTE
Because you have to make changes to the Telnet client provided by Windows to
communicate with DataMan, it is recommended you use third party clients such as PuTTY.
Enable:
||>SET MODBUSTCP.ENABLED ON
||>CONFIG.SAVE
||>REBOOT
Disable:
||>SET MODBUSTCP.ENABLED OFF
||>CONFIG.SAVE
||>REBOOT
NOTE
You must reboot the device for the change to take effect.
Setup Tool
Modbus TCP can be enabled by checking Enabled on the Industrial Protocols pane‟s
Modbus TCP tab. Make sure you save the new selection by clicking Yes to the Reboot
Required message window.
Getting Started
By default, Modbus TCP is not enabled on the DataMan reader. The protocol must be
enabled and the protocol configuration parameters must be set to correctly interact with a
PLC. Protocol configuration is accomplished via the DataMan Setup Tool.
1. From the Windows Start menu, start the Setup Tool.
2. Under Communication Settings, click the Industrial Protocols node.
3. Select the Modbus TCP tab.
Network Configuration
The network configuration defines all the information that the DataMan reader needs to
establish a connection with a PLC. In most cases the default values may be used and no
changes are need.
Maximum number of
Max
3 1-6 simultaneous Modbus TCP
Connections
connections.
Interface
This section describes the interface to the DataMan reader as seen by the PLC via Modbus
TCP. The interface model consists of 6 data blocks grouped in 3 logical pairs:
Control and Status
Input Data and Output Data
String Command and String Response
The following list contains the data blocks, their start/end addresses and their length.
Control Block
The Control block contains bit type data. This block consists of the control signals sent from
the PLC to the reader. It is used by the PLC to initiate actions and acknowledge certain data
transfers.
24-31 SoftEvents Bits act as virtual discrete inputs. When a bit transitions from
01 the associated action is executed. After executing the
action the reader sets the corresponding SoftEventAck to
signal that the action is complete. This forms a logical
handshake between the PLC and reader.
Bit0: Train code
Bit1: Train match string
Bit2: Train focus
Bit3: Train brightness
Bit4: Un-Train
Bit5: Reserved (future use)
Bit6: Execute DMCC command
Bit7: Set match string
Status Block
The status block contains bit type data. This block consists of the status signals sent from
the reader to the PLC. It is used by the reader to signal status and handshake certain data
transfers.
Operation
Modbus TCP is a request/response based protocol. All communications are originated from
the PLC. The reader acts as server.
Requests
To initiate actions or control data transfer, the PLC changes the state of certain bits of the
Control block and sends requests to the reader.
After each request, the reader will process changes in state of the bits in the Control block.
Some state changes require additional communications with the PLC, such as writing
updated acknowledge bit values or reading a new string command. These additional
communications are handled automatically by the reader. Other state changes initiate
PLC DataMan
perform action
initiate response
Handshaking
A number of actions are accomplished by means of a logical handshake between the reader
and the PLC (triggering, transferring results, executing soft events, string commands, and
so on). This is done to ensure that both sides of a transaction know the state of the
operation on the opposite side. Network transmission delays will always introduce a finite
time delay in transfer data and signals. Without this handshaking, it is possible that one
side of a transaction might not detect a signal state change on the other side. Any
operation that has both an initiating signal and corresponding acknowledge signal will use
this basic handshake procedure.
The procedure involves a four-way handshake.
1. Assert signal
2. Signal acknowledge
3. De-assert signal
4. De-assert acknowledge
The requesting device asserts the signal to request an action (set bit 01). When the
target device detects the signal and the requested operation has completed, it asserts the
corresponding acknowledge (set bit 01). When the requesting device detects the
acknowledge, it de-asserts the original signal (10). Finally, when the target device
detects the original signal de-asserted, it de-asserts its acknowledge (bit 01). To function
correctly both sides must see the complete assert/de-assert cycle (01 and 10). The
requesting device should not initiate a subsequent request until the cycle completes.
Acquisition Sequence
DataMan can be triggered to acquire images by several methods. It can be done by setting
the Trigger bit or issuing a trigger String Command. It can also be done via DMCC
Trigger EN
Trigger Ready 1 2 3
1 2 3
Trigger 1 2 M 3
1 2 M 3
Trigger Ack
1 1 2
2
M
M
3
3
Acquiring 1 2 3
2 3
1
Missed Acq M
M
Acquisition #1 Acquisition #2 Missed Acq Acquisition #3
PLC
DataMan
To force a reset of the trigger mechanism set the TriggerEnable to False until TriggerReady
is also set to False. Then, TriggerEnable can be set to True to re-enable acquisition.
As a special case, an acquisition can be cancelled by clearing the Trigger signal before the
read operation has completed. This allows for the cancellation of reads in Presentation and
Manual mode if no code is in the field of view. To ensure that a read is not unintentionally
cancelled, it is advised that the PLC hold the Trigger signal True until both TriggerAck and
ResultsAvailable are True (or DecodeComplete toggles state).
Trigger Ready 1 2
1 2
Trigger 1
1 2
Trigger Ack 1 2
1 2
Acquiring 1 2
1 2
Decoding 1 2
1 2
Decode Cmplt 1 22
1
Results Avail 1 2
1 2
Results Ack 1 h
1 2t
t
Read #2 p
Read #1
:
PLC
/
DataMan /
w
w
w
Results Buffering
.
There is an option to enable a queue for read results. If enabled, this allows a finite number
f
of sets of result data to be queued up until the PLC has time to read them. This is useful to
a
smooth out data flow if the PLC slows down for short periods of time.
c
Also, if result buffering is enabled the reader will allow overlapped acquisition and decode e
operations. Depending on the application this can be used to achieve faster overall trigger b
rates. See the Acquisition Sequence description for further details. o
o
In general, if reads are occurring faster than results can be transferred to the PLC, some k
data will be lost. The primary difference between buffering or not buffering determines .
which results get discarded. If buffering is not enabled, the most recent results are kept c
and the earlier result (which was not read by the PLC quickly enough) is lost. The more o
recent result will overwrite the earlier result. If buffering is enabled (and the queue m
becomes full) the most recent results are discarded until room becomes available in the /
results queue. a
l
SoftEvents b
SoftEvents act as “virtual” inputs. When the value of a SoftEvent bit changes from 0 1 u
the action associated with the event will be executed. When the action completes, the m
corresponding SoftEventAck bit will change from 0 1 to signal completion. .
p
h
p
?
a
DataMan® Communications and Programming Guide i
12/2/2011 | Version 4.2 d
P a g e | 92 =
2
Modbus TCP
The SoftEvent and SoftEventAck form a logical handshake. After SoftEventAck changes to
1, the original SoftEvent should be set back to 0. When that occurs, SoftEventAck will
automatically be set back to 0.
NOTE
Do not execute soft events that change the reader configuration at the same time that
reads are being triggered. Changing configuration during acquisition/decode can lead to
unpredictable results.
The “ExecuteDMCC” and “SetMatchString” soft event actions require user supplied data.
This data must be written to the UserData and UserDataLength area of the Input Data
block prior to invoking the soft event. Since both of these soft events depend on the
UserData, only one may be invoked at a time.
String Commands
The DataMan MC Protocol implementation includes a String Command feature. This feature
allows you to execute string-based DMCC commands. The DMCC command is sent to the
reader via the String Command block. The DMCC command result is returned via the String
Command Result block. Initiating a command and notification of completion is
accomplished by signaling bits in the Control and Status blocks.
To execute a DMCC command, the command string is placed in the data field of the String
Command block. The command string consists of standard ASCII text. The command
format is exactly the same as would be used for a serial (RS-232) or Telnet connection.
The string does not need to be terminated with a null character. Instead, the length of the
string (that is, the number of ASCII characters) is placed in the length field of the String
Command block.
After executing the DMCC command, the result string is returned in the String Command
Result block. Similar to the original command, the result string consists of ASCII characters
in the same format as would be returned via serial or Telnet. Also, there is no terminating
null character. Instead, the length of the result is returned in the Command String Result
length field. The Command String Result block also contains a numeric result code. This
allows you to determine the success or failure of the command without having to parse the
text string. The values of the result code are defined in the DMCC documentation.
SoftEvent
SoftEventAck
GeneralFault
Examples
Included with the Setup Tool installer are two example PLC programs created with CoDeSys
v2.3 software. These samples are designed and tested on a Wago 750-841 PLC. These
simple programs clearly demonstrate DataMan ID readers‟ capabilities and proper
operation. The same operations can be achieved by using more advanced features and
efficient programming practices with Wago PLCs.
However, such an advanced program is less useful for demonstration purposes. The
examples try to show different approaches in the techniques used for the communication to
the DataMan reader.
NOTE
All examples are designed to work only if the “Control” datablock is mapped to the Coil
space and the “Status” datablock is mapped to the Discrete Input space.
ApplicationLayer Example
This sample realizes a generic data transfer between the DataMan reader and the PLC.
Memory areas of the “Control”, “Status” and “Output Area” are cloned in the PLC and
synchronized as needed or cyclically. Each data area is synchronized with its own instance
of “ETHERNETMODBUSMASTER_TCP”. This causes 3 TCP connections to be open
simultaneously. Make sure that the Modbus TCP related setting “Maximum Connections” on
the DataMan reader is set to at least 3 for this example to work.
Function
The example application demonstrates the following operations:
1. Transfer the 32-bit “Control” register data from the PLC to the reader.
2. Transfer the 32-bit “Status” register data from the reader to the PLC.
3. Transfer “Output Data” from the reader to the PLC.
All actions are started when there is a connection to the reader.
DataManControl Example
This sample shows in a sequential manner the steps to do to achieve one of the functions
named in the following subsection. To outline this chronological sequence “Sequential
Function Chart” was chosen as programming language.
Function
The example application demonstrates the following operations:
1. Triggering a read
2. Getting read results
3. Executing string commands (DMCC)
4. Executing soft event operations
a. Train code
c. Train focus
d. Train brightness
e. Untrain
f. Execute DMCC
The “Main” program contains variables to invoke each of these operations. The operation is
invoked by toggling the control bool directly or from the visualization (red=0, green=1)
from 0 1. This will invoke the associated subroutine to perform the operation. When the
operation 4 is complete, the subroutine will set the control bit back to 0.
Triggering a Read
The example provides a “Continuous Trigger”. As the name implies, enabling the “xTrigger”
bit will invoke a continuous series of read operations. Once enabled, the “xTrigger” control
bit will remain set until you disable it.
Primarily, the trigger subroutine manages the trigger handshake operation between the
PLC and the reader. The control Result Ack and Trigger bits are reset, the Trigger Enable
bit is set, the PLC waits for the corresponding TriggerReady status bit from the reader, and
the control Trigger bit is set. Refer to a description of handshaking in Section Operation.
For this example the operation of triggering a read and getting read results was
intentionally separated. This is to support the situation where the PLC is not the source of
the read trigger. For example, the reader may be configured to use a hardware trigger. In
such a case, only the get results subroutine would be needed.
Like the triggering subroutine, the get results subroutine manages the results handshake
operation between the PLC and the reader. The routine waits for the ResultsAvailable
status bit to become active, it copies the result data to internal storage, and then executes
the ResultsAck handshake. Refer to a description of handshaking in Section Operation.
The read result consists of a ResultCode, ResultLength, and ResultData. Refer to Section
Output Data Block Field Descriptions for details of the ResultCode values. The ResultLength
field indicates how many bytes of actual result data exist in the ResultData field. The
subroutine converts this byte length to word length before copying the results to internal
storage.
PROFINET
PROFINET is an application-level protocol used in industrial automation applications. This
protocol uses standard Ethernet hardware and software to exchange I/O data, alarms, and
diagnostics.
DataMan supports PROFINET I/O. This is one of the 2 “views” contained in the PROFINET
communication standard. PROFINET I/O performs cyclic data transfers to exchange data
with Programmable Logic Controllers (PLCs) over Ethernet. The second “view” in the
standard, PROFINET CBA (Component Based Automation), is not supported.
A deliberate effort has been made to make the DataMan PROFINET communication model
closely match the Cognex In-Sight family. Customers with In-Sight experience should find
working with DataMan familiar and comfortable.
By default, the DataMan has the PROFINET protocol disabled. The protocol can be enabled
via DMCC, scanning a parameter code or in the Setup Tool.
DMCC
The following commands can be used to enable/disable PROFINET. The commands can be
issued via RS-232 or Telnet connection.
NOTE
Because you have to make changes to the Telnet client provided by Windows to
communicate with DataMan, it is recommended you use third party clients such as PuTTY.
Enable:
||>SET PROFINET.ENABLED ON
||>CONFIG.SAVE
||>REBOOT
Disable:
||>SET PROFINET.ENABLED OFF
||>CONFIG.SAVE
||>REBOOT
NOTE
You must reboot the device for the change to take effect.
Setup Tool
The PROFINET protocol can be enabled by checking Enabled on the Industrial Protocols
pane‟s PROFINET tab.
Make sure you save the new selection by clicking Yes to the Reboot Required message
window.
NOTE
You must reboot your reader for the new settings to take effect.
Getting Started
Preparing to use PROFINET involves the following main steps:
Make sure you have the Siemens Step 7 programming software (SIMATIC) installed.
Set up the Siemens Software tool so that it recognizes your DataMan device.
Install the Generic Station Description (GSD) file.
Perform the following steps to set up PROFINET:
1. Verify that SIMATIC is on your machine.
2. From the Windows Start menu, launch the SIMATIC Manager.
3. If you already have a project, select “Cancel” to skip past the New Project wizard.
Otherwise, let the wizard guide you through creating a new project.
4. Once the Manager has opened the project, double-click on the “Hardware” icon to
open the “HW Config” dialog screen. From the main menu, select “OptionsInstall
GSD File…”.
5. Browse to the location where the GSD file was installed (or the location where you
saved the GSD file if it was downloaded from the web).
NOTE
There may be more than one GSD file in the list. If you are unsure which to install,
choose the one with the most recent date.
7. Add your DataMan device to your project. This makes the DataMan available in the
Hardware Catalog. Launch the SIMATIC Hardware Config tool.
8. In the main menu, select View Catalog.
9. The catalog is displayed. Expand the “PROFINET IO” tree to the “Cognex ID Readers”
node.
10. With the left mouse button, drag the DataMan reader over and drop it on the
PROFINET IO network symbol in the left pane.
The HW Config tool automatically maps the DataMan I/O modules into the memory
space.
NOTE
By default, the 64 byte User Data and 64 byte Result Data Modules are inserted. There
are multiple sizes available for both of these modules. To optimize performance use
the module size that most closely matches the actual data requirements of your
application. You can change the module simply by deleting the one in the table and
inserting the appropriate sized module from the catalog.
14. In the “IO Cycle” tab, select the appropriate cyclic update rate for your application.
15. By default, the SIMATIC software maps the User Data & Result Data Modules to offset
256. This is outside of the default process image area size of 128. That is, by default,
data in these modules are inaccessible by some SFCs such as BLKMOV. As a solution,
either remap the modules to lower offsets within the process image area or expand
the process image area to include these modules.
If you choose to expand the process image area, make the size large enough for the
module size plus the default 256 offset.
NOTE
Expanding the process image can have a performance impact on the PLC scan cycle time. If
your scan time is critical, use the minimal acceptable module sizes and manually remap
them down lower in the process image.
Modules
The PROFINET implementation on DataMan consists of seven I/O modules.
1. Acquisition Control Module
2. Acquisition Status Module
3. Results Control Module
4. Results Status Module
5. Soft Event Control Module
6. User Data Module
7. Result Data Module
0 Trigger Enable Setting this bit enables triggering via PROFINET. Clearing
this bit disables triggering.
Bit transition from 01 will cause the train code operation
0 Train Code
to be invoked.
1 Bit transition from 01 will cause the train match string
Train Match String
operation to be invoked.
Bit transition from 01 will cause the train focus operation
2 Train Focus
to be invoked.
Bit transition from 01 will cause the set match string
7 Set Match String operation to be invoked. Note that match string data must
first be placed in “User Data” before invoking this event.
0 Train Code Ack Indicates that the “Train Code” operation has completed
2 Train Focus Ack Indicates that the “Train Focus” operation has completed
6 Execute DMCC Ack Indicates that the “Execute DMCC” operation has completed
Slot number: 6
Total Module size: 4 + 16 (16 bytes of User Data)
4 + 32 (32 bytes of User Data)
4 + 64 (64 bytes of User Data)
2-3 User Data Length Number of bytes of valid data actually contained in the
“User Data” field (16-bit Integer).
There are actually 5 versions of the Result Data module. Only a single instance can be
configured for use in a given application. The “Result ID”, “Result Code”, “Result Extended”
and “Result Length” fields are the same for each module. The “Result Data” field varies in
size based on the selected module. Choose the module which is large enough to exchange
the amount of result data required by your application.
Slot number: 7
Total Module size: 8 + 16 (16 bytes of Result Data)
8 + 32 (32 bytes of Result Data)
8 + 64 (64 bytes of Result Data)
8 + 128 (128 bytes of Result Data)
8 + 246 (246 bytes of Result Data)
Operation
SoftEvents
SoftEvents act as “virtual” inputs. When the value of a SoftEvent changes from 0 1 the
action associated with the event will be executed. When the action completes the
corresponding SoftEventAck bit will change from 0 1 to signal completion. The
acknowledge bit will change back to 0 when the corresponding SoftEvent bit is set back to
0.
The “ExecuteDMCC” and “SetMatchString” soft event actions require user supplied data.
This data must be written to the UserData & UserDataLength area of the UserData Module
prior to invoking the soft event. Since both of these soft events depend on the UserData,
only one may be invoked at a time.
SoftEvent
SoftEventAck
GeneralFault
Trigger EN
Trigger Ready 1 2 3
1 2 3
Trigger 1 2 M 3
1 2 M 3
Trigger Ack 1 2 M 3
1 2 M 3
Acquiring 1 2 3
1 2 3
Missed Acq M
M
Acquisition #1 Acquisition #2 Missed Acq Acquisition #3
Client
DataMan
Behavior of DecodeStatusRegister
Set when new results are Set when new results are
placed in the Results Module. placed in the Results Module.
4 Results Available Stays set until the results Stays set until the results are
are acknowledged by setting acknowledged by setting
Results Ack to true. Results Ack to true.
Trigger 1 2
Ready 1 2
Trigger 1
1 2
Trigger 1 2
Ack 1 2
Acquiring 1 2
1 2
Decoding 1 2
1 2
Decode 1 22
Cmplt 1
Results 1 2
Avail 1 2
Results 1 h
Ack 1 2t
t
Read #2 p
Read #1
:
Client
/
DataMan /
w
w
Results Buffering w
There is an option to enable a queue for decode results. If enabled this allows a finite .
number of decode result data to queue up until the client (PLC) has time to read them. This f
is useful to smooth out data flow if the client (PLC) slows down for short periods of time or a
if there are surges of read activity. c
e
Also, if result buffering is enabled the device will allow overlapped acquisition and decode b
operations. Depending on the application this can be used to achieve faster over all trigger o
rates. See Acquisition Sequence description above for further detail. o
In general, if reads are occurring faster than results can be sent out, the primary difference k
.
between buffering or not buffering is determining which results get discarded. If buffering
c
is not enabled the most recent results are kept and the earlier result (which was not read
o
by the PLC fast enough) is lost. Essentially the more recent result will simply over write the
m
earlier result. If buffering is enabled (and the queue becomes full) the most recent results
/
are discarded until room becomes available in the results queue. a
l
Siemens Examples b
This section gives some examples of using the DataMan with a Siemens S7-300 PLC. It is u
assumed that the reader is familiar with the S7-300 and the SIMATIC programming m
software. .
p
Symbol Table h
Although not required, defining symbols for the DataMan I/O module elements can be p
?
extremely helpful. It makes the code much easier to read and reduces mistakes. This
a
sample table shows symbols defined for a typical instance of a DataMan reader. Note,
i
d
=
DataMan® Communications and Programming Guide 2
12/2/2011 | Version 4.2 7
P a g e | 112 8
6
PROFINET
DataMan I/O modules may be at different addresses in your project. Make sure to adjust
your symbol definitions based on the specific offsets of the I/O modules.
5. Look for the Siemens folder and select the zip file.
7. The Siemens software extracts the sample archive and makes it available.
8. Reduced to the basics the process of reading and retrieving results consists of the
following:
9. Define an area in your application to save read results. There are many options
regarding how and where result data can be stored. For our example we define a Data
Block (DB) which contains the fields of the Result Data module that we are interested
in for our application.
11. Set the trigger signal and set semaphore to indicate a read is pending.
12. As soon as the trigger signal is acknowledged, clear the trigger signal.
13. As soon as the results are available save a copy of the result data and set the results
acknowledge signal.
NOTE
The reader clears “Results Available” as soon as it sees the PLC‟s “Results Ack” signal.
7. The Siemens software extracts the sample archive and makes it available.
Soft events are a means of invoking an activity by simply manipulating a single control bit.
The activity for each bit is predefined (for more details, see Section SoftEvents). With the
exception of “Execute DMCC” and “Set Match String” all soft events may be invoked in the
same way. “Execute DMCC” and “Set Match String” require the added step of loading the
User Data module with application data before invoking the event.
The function “Set User Data” (FC11) simply copies the provided string to the User Data
module. Refer to the example program for the actual STL code.
For a complete list of DMCC commands, click the Windows Start menu and
browse to Cognex DataMan Setup Tool v x.x Documentation Command
Reference.
DMCC Overview
Depending on the DataMan reader you are using, the COM port connection can be either
RS232 or USB and an Ethernet connection can be established through the Telnet protocol.
By default, the DataMan reader is configured to communicate over TCP port number 23,
but you can use the Setup Tool to assign a different port number as necessary.
Command Syntax
All DMCC commands are formed of a stream of ASCII printable characters with the
following syntax:
command-header command [arguments] footer
For example:
||>trigger on\CR\LF
Header Examples
Example Description
||> Default Header
||0:123> Header indicating no-checksum and ID of 123
||1> Header indicating checksum after command and data.
Command
The command is an ASCII typable string possibly followed by data. All command names
and public parameters data are case insensitive. Only a single command may be issued
Commands
Short names specifying an action. A commonly used command is GET or SET followed by a
Parameter and Value.
Parameters
Short names specifying a device setting. Parameter names are organized with a group of
similar commands with one level of structural organization separated by a period ('.').
Arguments
Boolean: ON or OFF
Integer: 123456
String: ASCII text string enclosed by quotes (“).The string content is passed to a function
to translate the string to the final format. The following characters must be backslash
escaped: quote (\”), backslash (\\), pipe (\|), tab (\t), CR(\r), LF (\n).
Footer
The footer is a carriage return and linefeed (noted as \CR\LF or \r\n).
Reader Response
The reader will have one of several response formats. The choice of response format is
configured using the SET COM.DMCC-RESPONSE command.
Silent: (0, Default) No response will be sent from the reader. Invalid commands are
ignored without feedback. Command responses are sent in space delimited ASCII text
without a header or footer.
Extended: (1) The reader responds with a header data footer block similar to the
command format.
NOTE
While the reader can process a stream of DMCC commands, it is typically more robust to
either wait for a response, or insert a delay between consecutive commands.
||checksum:command-id[status]
checksum
The response uses the same checksum format as the command sent to the reader.
0: no checksum
1: last byte before footer is XOR of bytes
command-id
The command-id sent to the reader is returned in the response header.
status
An integer in ASCII text format.
0: no error
1: reader initiated read-string
100: unidentified error
Examples
using Cognex.DataMan.SDK;
using Cognex.DataMan.SDK.Events;
to find the different elements belonging to the SDK in these namespaces. They will appear
in the intellisense as seen in the following image:
myManager.SystemDiscovered += new
DataManSystemManager.SystemDiscoveredEventHandler(myManager_NetworkDeviceApp
eared);
where the address is a string. This can be a COM port (for example, “COM23”) or an IP
address (for example, “10.10.123.42”).
3. Call the Connect() method of your DataManSystem instance.
mySystem.Connect(myParams);
if (mySystem.IsConnected())
5. To disconnect, call
mySystem.Disconnect();
NOTE
Check the events of DataManSystem. After calling Connect(), subscribe to the events that
you need. Unsubscribe before calling Disconnect().
Distribué par :