SLMP Scanner Factory Interface - In-Sight 4.x.x Firmware

This topic covers the SLMP Scanner communication protocol for In-Sight vision systems running In-Sight 4.x.x and earlier firmware. For a complete list of models and supported firmware versions, see Firmware Versions.

SLMP Scanner Operations

SLMP Scanner is a command/response-based protocol, which originates from the In-Sight vision system, and the vision system must send read requests to the Automation Controller at periodic intervals to determine if there are changes in the control bits. This process is called "polling," and defines the polling cycle.

Polling Cycle

At the beginning of every polling cycle, the Vision Control Bit block will be read from the Automation Controller.The vision system will then process any bit state-change in the control block, in order.Some state-changes will require additional communication with the Automation Controller, such as reading a Job ID or the User Data fields, or writing the status block.These requests are placed in a queue.The polling mechanism processes these requests, in order, until there are either no more items in the queue, or the polling interval has been exceeded.Once the polling cycle has been completed, the cycle will not repeat.

Note:
  • Any communication items that were placed in the queue from the previous cycle, but were not processed, will be the first items processed during the next cycle.If there are several items in the queue at the beginning of the cycle, at least one item from the queue will always be processed during each polling cycle, even if the processing might delay the next polling cycle.
  • The Poll Interval (ms) parameter in the SLMP Scanner Settings dialog allows you to define the polling cycle interval.

Block Communications

The table below defines the actions that the In-Sight vision system will take in response to a status bit change in the Vision Control Bit block:

Block When Read/Written Action
Vision Control Bit Block Read at a user-specified periodic interval.

Acquisition Trigger

Soft Event

Read or Write of any other block

Vision Status Bit Block Written when the connection is first established, and when a new status is available.
PLC Input Word Block Written when new inspection results are available, or when a job change occurs.
PLC Output Word Block Read when the Set User Data bit changes from 0 to 1, or when the Initiate Job Load bit changes from 0 to 1. Setting the User Data Ack bit after reading the User Data field.
String Command Word Block Read when the Initiate String Command bit changes from 0 to 1. Processing the String Command.
String Command Result Block Written when new string command results are available. Setting the String CMD Ack bit, after writing the String Command Result Word Block.

Typical Sequence Diagram

The following diagram illustrates the typical behavior of the In-Sight vision system in response to a Automation Controller triggering an acquisition and inspection cycle:

Typical Acquisition Sequence

An In-Sight vision system can be triggered by directly manipulating the Trigger Enable and Trigger bits in the Vision Control Block, or by monitoring the Trigger Ready, Trigger Ack, Acquiring and Missed Acq bits in the Vision Status Block.

On initial start-up, the Trigger Enable bit will be False, and must be set to True to enable triggering. When the vision system is ready to accept triggers, the Trigger Ready bit in the Vision Status Block will be set to True.

While the Trigger Enable and Trigger Ready bits are True, each time the vision system sees the Trigger bit change from 0 to 1, an image acquisition will be initiated. The Trigger bit should be held in the new state until that same state value has been seen in the Trigger Ack bit of the Vision Status Block (which is a necessary handshake to guarantee that the change has been seen by the vision system).

During an acquisition, the Trigger Ready bit in the Vision Status Block will be cleared and the Acquiring bit will be set to True. When the acquisition is completed, the Acquiring bit will be cleared and the Trigger Ready bit will again be set to True once the vision system is ready to begin a new image acquisition.

To force a reset of the trigger mechanism, set the Trigger Enable bit to False until the Vision Status Block is 0. Then the Trigger Enable bit can be set to True and acquisitions re-enabled.

Typical Inspection Sequence

When an image is acquired by an In-Sight vision system, the image is placed in a queue for processing. While the vision system is processing the image, the Inspecting bit of the Vision Status Block is set. When the vision system has finished processing the image, the Inspecting bit is cleared and the Inspection Completed bit is toggled.

The Buffer Results Enable bit of the Vision Control Block determines how inspection results are handled by the vision system. If the Buffer Results Enable bit is set to False, then the inspection results are immediately placed into the Output Word Block and the Results Valid bit is set to True. If the Buffer Results Enable bit is set to True, the new results are queued. The earlier inspection results remain in the Output Word Block until they are acknowledged by the Automation Controller, which sets the Inspection Results Ack bit to True.After the Results Valid bit is cleared, the Automation Controller should set the Inspection Results Ack bit back to False to allow the queued results to be placed into the Output Word Block (this is a necessary handshake to ensure that the results are received by the Automation Controller).

Inspection Status Register Behavior

Bit Bit Name Results If Buffering Is Disabled Results If Buffering Is Enabled
0

Inspecting

Set when inspecting an image.

Set when inspecting an image.

1

Inspection Complete

Toggled on completion of an inspection.

Toggled on completion of an inspection.

2

Results Buffer Overflow

Remains set to 0. Set when the inspection results could not be queued because the Automation Controller failed to acknowledge the previous results, causing the results buffer to overflow. Cleared when an inspection result is successfully queued.
3

Results Valid

Set when new results are placed in the Output Word Block.Stays set until the results are acknowledged by setting the Inspection Results Ack bit to True.

Set when new results are placed in the Output Word Block. Stays set until the results are acknowledged by setting the Inspection Results Ack bit to True.

Results Buffering

A queue for inspection results may be enabled. If enabled, this allows a finite number of inspection data results to be queued until the Automation Controller has time to read them. This is a useful feature for smoothing out data flows if different parts of the system (including the external Automation Controller) slow down for short periods of time.

In general, if inspections are occurring faster than the results can be sent out, the primary difference between buffering and not buffering is determining which results get discarded. If buffering is not enabled, the most recent results are kept, and the earlier result that the Automation Controller was unable to read is lost. Essentially, the most recent result will simply 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.

Typical Job Management Sequence

The Current Job ID field indicates the current job ID of the In-Sight vision system, or 65535 if the current job does not have an ID. In order to load a job, the Automation Controller must set the vision system Offline by using the Set Offline bit. Next, the Job Load ID field is set to the desired job's ID and the Initiate Job Load bit is set. Once the Job Load Complete bit goes to High, the Initiate Job Load bit is reset.

Typical Soft Event Sequence

A soft event can be used by the Automation Controller to trigger job specific behavior. Each soft event has a trigger and acknowledgment bit associated with it. The rising edge of the trigger bit causes the In-Sight vision system to process the action associated with the soft event. Upon initiation of the soft event, the vision system will set the corresponding Soft Event Ack bit to High. This bit will be held High until the Automation Controller resets the trigger bit, and the processing of the action associated with the soft event has been completed. If the soft event could not be triggered, the general fault bit will be set to High; this bit will remain High until an event is successfully triggered.

Note: In job deployment environments where In-Sight Explorer or the VisionView application are monitoring inspections, if the job depends on a Soft Event (e.g., configured as a Timer function) to trigger a spreadsheet event, it may cause the inspection of an image to be delayed if it is triggered shortly before the acquisition cycle completes. If the job file is large (i.e., it contains many Vision Tools, such as Pattern Match, Flaw Detection or InspectEdge tools, in addition to other job logic), the update required by In-Sight Explorer or VisionView may prevent an image from being inspected until the display update is queued. For applications that require exact timing (e.g., measured in the 10s of milliseconds), this update might delay the determination of pass/fail results and the transmission of results to the next station (e.g., a PLC or motion controller) in the inspection process. To avoid delayed inspections in these application environments, Cognex recommends Soft Events not be used.

Typical String Command Sequence

In-Sight vision systems rely on Native Mode communications to support string commands for device interaction. Native Mode commands allow a string-style command to be issued from the Automation Controller to the vision system, which are especially useful when a command cannot be issued via the control bits. This section defines the common interface to be used when initiating string commands to the vision system, and how to obtain the response from the vision system.

SLMP Defined Data Blocks

The defined data blocks allow you to control where the vision system is reading and writing data to and from the Automation Controller. For easier application setup, the various control and status bits required for command functionality are grouped into contiguous blocks, which can be processed together. When setting up the interaction between the vision system and the Automation Controller, you will need to choose the starting address and device type for each block of data.

Vision Control Block

The Vision Control Block defines all of the bit-typed signals for any action that the Automation Controller might initiate. The Vision Control Block is 32 bits, some of which are reserved for future implementations.

Block Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Vision Control 0 Set Offline Reserved Initiate Job Load Inspection Results Ack Buffer Results Enable Trigger Trigger Enable
1 Reserved
2 Reserved Clear Exposure Complete Reserved Initiate String Command Set User Data
3 Soft Event 7 Soft Event 6 Soft Event 5 Soft Event 4 Soft Event 3 Soft Event 2 Soft Event 1 Soft Event 0

Byte 0

Bit Name Description
7 Set Offline

When this bit is set, the In-Sight vision system is taken Offline until the bit is cleared again.

6-5 Reserved Unused.
4 Initiate Job Load When set, the vision system loads the job ID specified in the Job Load ID field.
3 Inspection Results Ack When the Buffer Results Enable bit is set, the Inspection Results Ack bit is set by the Automation Controller to acknowledge that it has received the InspectionCount, Inspection Result Code and Inspection Results data. The next set of inspection results is then sent to the Automation Controller. Clearing the Inspection Results Ack bit causes the vision system to set the Results Valid bit if the buffer is not empty.
2 Buffer Results Enable When this bit is set, the Inspection Count, Inspection Result Code and Inspection Results fields are held constant until they are acknowledged by setting the InspectionResults Ack bit. Up to eight inspections are held in the In-Sight vision system's buffer. The vision system will respond to the acknowledgment by clearing the ResultsValid bit. Once the InspectionResults Ack bit is cleared and there is a new set of results sent to the Automation Controller, the ResultsValid bit will no longer be cleared. If the Inspection Results Ack bit is cleared and there are no more results in the vision system's buffer that are to be sent to the Automation Controller, the ResultsValid bit remains cleared.
1 Trigger

Setting this bit triggers an acquisition when the following conditions are met:

  • The In-Sight vision system is Online.
  • The Trigger Enable bit is set.
  • The Acquire Image function's Trigger parameter is set to External or Industrial Ethernet.
0 Trigger Enable This field is set to enable triggering via the Trigger bit. Clear this bit to disable the network triggering mechanism.

Byte 1

Bit Name Description
7-1 Reserved Unused.

Byte 2

Bit Name Description
7-4 Reserved Unused.
3 Clear Exposure Complete

While this signal is High, the Exposure Complete status will remain reset. Once this signal is set to Low, the Exposure Complete status will be set to High on the next exposure completion.

2 Reserved

Unused.

1 Initiate String Command When this bit is set, it will read the data from the String Command field and execute the string command. Upon reading the command, the String Cmd Ack bit will be set. This bit should be held High until the vision system sets the String Cmd Ack bit to ensure that the vision system has received the command.
0 Set User Data This command is used by the Automation Controller to indicate to the In-Sight vision system that it should transfer the User Data field into a holding buffer for consumption by the vision system.

Byte 3

Bit Name Description
7 Soft Event 7 Allows Spreadsheet soft events to be triggered. Setting any of these bits causes the associated soft event in the Spreadsheet to be triggered.
6 Soft Event 6
5 Soft Event 5
4 Soft Event 4
3 Soft Event 3
2 Soft Event 2
1 Soft Event 1
0 Soft Event 0

Vision Status Bit Block

Block Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Vision Status 0 Online Offline Reason Missed Acq Acquiring Trigger Ack Trigger Ready
1 Reserved Job Load Failed Job Load Completed Job Loading Results Valid Results Buffer Overrun Inspection Completed Inspecting
2 Reserved Job Pass Exposure Complete String Command Error String Command Ack Set User Data Ack
3 Soft Event Ack 7 Soft Event Ack 6 Soft Event Ack 5 Soft Event Ack 4 Soft Event Ack 3 Soft Event Ack 2 Soft Event Ack 1 Soft Event Ack 0

Byte 0

Bit Name Description
7 Online This bit is set when the In-Sight vision system is Online, and cleared when the vision system is Offline. When the vision system is Offline, examine the Offline Reason field to determine the reason.
6-4 Offline Reason This field is a 3-bit field used to identify the cause of why an In-Sight vision system is Offline:
Offline ReasonNameDescription

0

Online

The vision system is Online.

1

Programming

The vision system's job is being modified.

2

Discrete Offline

A discrete signal is holding the vision system Offline.

3

Comm. Offline

A communications protocol is holding the vision system Offline.

Note: It is possible to have multiple devices holding the In-Sight vision system Offline. In this scenario, this field will return the channel with the lowest reason code.
3 Missed Acq Set when an In-Sight vision system misses an acquisition trigger, regardless how the acquisition was triggered; cleared when an acquisition is successfully triggered.
Note: If the Trigger bit is set, but the vision system is offline, the Missed Acq and Trigger Ack bits will both be set.
2 Acquiring Set when an In-Sight vision system is currently acquiring an image, regardless how the acquisition was triggered.
1 Trigger Ack Indicates when an In-Sight vision system has been triggered by the Trigger bit being set; this bit will stay set until the Trigger bit is cleared. In addition, the Acquisition ID can be latched to the rising edge of this bit.
Note: If the Trigger bit is set, but the vision system is offline, the Missed Acq and Trigger Ack bits will both be set.
0 Trigger Ready Indicates when an In-Sight vision system can accept a new trigger via the Trigger Bit. This field is true when the vision system is Online, the TriggerEnable bit is set, the AcquireImage function's Trigger parameter is set to External or Industrial Ethernet, and the vision system is not currently acquiring an image.

Byte 1

Bit Name Description
7 Reserved Unused.
6 Job Load Failed This bit is set when the last job load attempt failed. It is cleared after a successful job load, initiated by the SLMP Scanner protocol.
5 Job Load Completed This bit is toggled on the completion of a job load operation initiated by this protocol.
4 Job Loading This bit is set when a job load was initiated through this protocol.
3 Results Valid

Set when the Inspection Count, Inspection Result Code and Inspection Results fields are valid.

Note: If job processing is enabled to occur in overlapped mode, either the Buffer Results Enable bit should be enabled/set, or the Inspection Completed bit should be used to latch the inspection results.
2 Results Buffer Overrun This field is set when the Buffer Results Enable bit is set and the In-Sight vision system has discarded a set of inspection results because the Automation Controller has not acknowledged the results by setting the InspectionResults Ack bit. Up to eight inspections are held in the vision system's buffer; therefore, this bit is set when the ninth inspection is added to the buffer, and will overwrite the eighth inspection in the buffer. The bit is not cleared until a valid inspection occurs and a previous inspection is not overwritten.
1 Inspection Completed This bit is toggled upon the completion of an inspection. Set when the Inspection Count, Inspection Result Code, Inspection Results and/or Job Pass bits are valid.
0 Inspecting

This bit is set when an In-Sight vision system is running a job.

Byte 2

Bit Name Description
7-5 Reserved Unused.
4 Job Pass This bit is set if the most recent job passed as configured in the Job Pass/Fail Cell Setup dialog. This bit is cleared if the job did not pass.

The behavior of the Job Pass bit will depend on whether or not results buffering is disabled or enabled:

Buffering Is DisabledBuffering Is Enabled
  • Set when an inspection is completed and the Job Pass/Fail cell indicates pass; otherwise it remains cleared. For more information, see Job Pass/Fail Cell Setup Dialog.
  • The Job Pass bit will be valid prior to toggling the Inspection Completed bit.
  • Set when new results are placed in the InspectionResults attribute and the Job Pass/Fail cell indicated pass for that result set; otherwise it remains cleared. The state will not change until the results are acknowledged by setting the InspectionResultsAck attribute to True, at which time the bit will be cleared.
  • The Job Pass bit will be valid prior to the Results Valid bit being set.
3 Exposure Complete

This bit is set upon the completion of the In-Sight vision system's exposure period, and is cleared when an acquisition is triggered. This bit will be held in a reset state if the Clear Exposure Complete signal is set to High.

2 String Command Error This bit indicates whether or not the result of the previous string command returned a failure code.
1 String Command Ack This bit is set when the vision system completes processing of a command and generates a response to the command. After the vision system has set this bit, the Automation Controller can safely read the string command response data. The bit will be reset after the Automation Controller clears the Initiate String Command bit. The Automation Controller should clear the Initiate String Command bit and wait for the String Command Ack bit to return to a Low state before initiating a new command.
0 Set User Data Ack This bit is set to acknowledge completion of the Set User Data command.

Byte 3

Bit Name Description
7 Soft Event Ack 7 These bits are used to indicate that the Soft Event command was received.
6 Soft Event Ack 6
5 Soft Event Ack 5
4 Soft Event Ack 4
3 Soft Event Ack 3
2 Soft Event Ack 2
1 Soft Event Ack 1
0 Soft Event Ack 0

Output Word Block

Block Byte Name
Output Word 0..1 Current Job ID
2..3 Acquisition ID
4..5 Inspection ID
6..7 Inspection Result Code
8..9 Inspection Result Length
10.. Inspection Results

Byte 0 - 1

Name Description
Current Job ID A 16-bit integer that denotes the ID number of the currently running job on the vision system, or 65535 if the current job does not have an ID number. This field is updated when the job is changed on the vision system, regardless of method of job change.

Byte 2 - 3

Name Description
Acquisition ID The identifier is associated with the current acquisition, and is set to the Acquisition ID at then end of an acquisition, for an acquisition triggered using the Trigger bit.

Byte 4 - 5

Name Description
Inspection ID The acquisition ID associated with this set of results.

Byte 6 - 7

Name Description
Inspection Result Code The inspection result code is defined by the Result Code parameter of the WriteResultsBuffer function. For more information, see WriteResultsBuffer.

Byte 8 - 9

Name Description
Inspection Result Length The length of the inspection results data.

Byte 10 - 1914

Name Description
Inspection Results Inspection result data written from the spreadsheet, using the WriteResultsBuffer function.

Input Word Block

Block Byte Name
Input Word 0..1 Job Load ID
2..3 User Data Length
4.. User Data

Byte 0 - 1

Name Description
Job Load ID The ID number (1-999) of the job to load when the Initiate Job Load bit is set by the Automation Controller.

Byte 2 - 3

Name Description
Reserved Unused.

Byte 4 - 1920

Name Description
User Data Data buffer which can be read into the spreadsheet using the ReadUserDataBuffer or ReadLatchedUserDataBuffer function.

String Command Word Block

Block Byte Name
String Command Word 0..1 String Command Length
2.. String Command

Byte 0 - 1

Name Description
String Command Length The length of the Native Mode command.

Byte 2 - 1920

Name Description
String Command The Native Mode command to be processed by the vision system.

String Command Result Word Block

Block Byte Name
String Command Result Word 0..1 String Command Result Code
2..3 String Command Result Length
4.. String Command Result

Byte 0 - 1

Name Description
String Command Result Code

The response code for the Native Mode command, which can be used to determine if the command was successful, or failed.

Note: Each Native Mode command returns a 1 for a successful execution, while each command has specific error codes for cases of failure. Review the individual Native Mode command topics for more information about the failure codes.

Byte 2 - 3

Name Description
String Command Result Length The length of the Native Mode command's Response Data, in bytes.

Byte 4 -

Name Description
String Command Result The Native Mode command's result string, an ASCII string representation of the data returned by the command.