Cognex Vision System Protocol
This protocol has been written to extract information from a Cognex Vision System. The following information applies to the Cognex Vision System.
There is no device address for this protocol, as it is not possible to multi-drop the Cognex devices.
Further details on the device address can be found in the Device Properties Information Topic.
External Address
The External Address is an ascii string which exactly references an item of data within the PLC. It can be entered at configure time as a text string, and will be validated by the system before use. For this protocol the external address has the following format:
The external address format for all data types is a simple spreadsheet cell reference, the format of which is a fixed-length 4 character string, the first character being the column (A to Z), the remaining 3 digits being the row number (0-399). For example. D131
N - Dec number 0 – 9
A - Letter A-Z
Column |
Row |
A |
NNN |
Offset Format
The software also allows an item of data within the PLC to be referenced by means of a table selection and an offset. The following table shows the offset and table formats for the Cognex Vision System:
Table |
External Address Type |
Type |
Offset Format |
Offset Range |
Privilege R = Read W = Write |
Description |
Values |
Values |
See Note Below |
ANNN |
A000-Z399 |
RW |
Values |
Type Note The data type selected for the point must be the same as the data type of the spreadsheet cell.
Property Pages
No property pages exist for this protocol
Protocol Compatibility
Reading Data from the Device |
Data can be read from the device by setting a cell reference. Data will be converted to the appropriate type if possible. Empty cells will be converted to a value of zero or "false". |
Writing Data to the Device |
Data can only be written to the device if the target cell contains an edit box. All of the Cognex edit box types EditInt, EditFloat, and EditString are supported by this protocol: To ensure correct operation, the data type selected for the point should be the same as the data type selected for the Edit control. |
Whenever the Cognex System detects a communications error, it will set the protocol for the serial port to UNUSED unless a cell on the spreadsheet contains an EVENT statement to trap these errors.
The Cognex System should have the terminator characters set to 13 (Carriage return).
The Cognex System should be set to use the NATIVE protocol.
For efficiency, the protocol will attempt to gather data in blocks, and if possible we suggest data be collected from rows or columns of data, and that these be grouped together in blocks of the same data type.
Port Settings
Port settings are configurable for the unit itself. The following shows a typical port setup:
RS232
|
Baud Rate |
9600 |
|
Data Bits |
8 |
|
Stop Bits |
1.0 |
|
Parity |
None |
Note: The Vision System incorrectly uses RTS/CTS flow control, even when it is disabled. To use this protocol, the settings for flow control in the Cognex device should be NONE, the setting in the software should be set to handshake.
Wiring Information
Connection of the unit to a PC running OPC Server will be via any available COM port, which may be either 25 pin or 9 pin depending on what is available. The COM port pin out is shown below:
The Cognex Vision System has a standard 9 pin d-type connector:
The following shows the correct wiring for connection to the Cognex Vision System via the RS232 port:
Examples
Example 1
Cell B2 in the spreadsheet:
B002
Example 2
Cell H101 in the spreadsheet:
H101