The text of a manual · part 16 of 18
VS-06 Smart Camera, VS-06 User's Manual, pages 151 to 160
Pages 151 to 160 of 172
The original document is the PDF (3.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the di-soric VS-06
Page 151
In mode 1, the auto-trigger rungs are bypassed. This is the default mode of the demo code.
•
In mode 2, all rungs are executed.
Read_MV_IO_user Purpose User-accessible IO data for the camera. The user app reads and writes these IO tags, and the demo code handles the actual on-the-wire control of the camera. User App Method Activate a Control by setting its value to 1. The user app can determine that the Control is done when the Control is clear (demo code changes the Control to a bit/bool value of 0). Do not attempt to activate a Control unless it is clear. The user app should activate the Controls using one-shot writes. The use app should not continuously hold a Control in an active state. Holding a Control in an active state will prevent the demo code from notifying the user app that the Control operation is complete by clearing the Control. Usually, when a Control is clear (0), the camera is ready for the Control to be activated again. Please see the Specific Control Guidelines and Specific Status Guidelines below for qualifications. Demo Code Usage The demo code waits for the user app to activate a Control. When the user app activates a Control, the demo code handles all handshaking and confirmation that the Control operation is performed by the camera. When the operation is complete, the demo code clears the Control back to 0.
VS-06 Specific Control Guidelines GoOnline and GoOffline In order to take the camera Online and Offline, only one of these Controls can go active (change from 0 to 1), and be active, at any given time.
VS-06 Smart Camera Guide
G-7
G Demo PLC Code
•
Page 152
Appendix
G
Demo PLC Code
ResetCount After the user app activates ResetCount, the demo code will clear ResetCount when the operation is complete. The next Inspection output will be #1 (as can be seen if AutoVision is connected to the camera in run mode). VS-06 Trigger Do not trigger the camera unless the TriggerReady Status is active. If the Trigger goes active when TriggerReady is not active, the demo code increments the counter Read_MV_trigger_err_count, and immediately clears the Trigger Control, without attempting to trigger the camera. After the user app activates the Trigger, the demo code will clear the Trigger when the camera indicates it has accepted the Trigger. Do not re-trigger the camera until DataValid in the Status register goes active, all Inspection data has been processed, and the DataValid is cleared using the ResetDataValid Control. ResetDataValid When the user app sees DataValid go active, it should process the Inspection data, then clear DataValid by activating ResetDataValid. See Data Valid for more details. ResetError To clear the Error Status, activate ResetError. ExeCmd, CmdCode, CmdArg These Controls can be used to perform a job change, and query the active job slot. Refer to the CmdCode section of the EIP chapter for available command codes, command result codes, and a diagram of
G-8
VS-06 Smart Camera Guide
Page 153
command execution. The demo code includes tags with pre-defined CmdCode and CmdCodeRslt definitions:
The ExeCmd, CmdCode, and CmdArg controls are used in combination with these Status signals:
The demo code records the final result of the command operation by copying CmdCode, CmdArg, CmdCodeRslt and CmdRet to the following tags:
The demo code will automate the command process when Read_MV_demo_mode is 1, which is the default value at program startup, similar to how it assists the Triggering and DataValid Controls. The PLC integrator can initiate command operation by accessing the demo code’s Read_MV_IO_user tag set for Control and Status signals. While a command operation is active, the demo code forces all Control signals to an inactive state, except for the Echo. No Controls can be activated until the command operation is completed. To verify the camera is still “alive” during command execution, the Control.Echo can be incremented, and the Status.Echo will update accordingly. When the demo code automates the command process, the PLC integrator is responsible for the following steps:
VS-06 Smart Camera Guide
G-9
Demo PLC Code
G
Page 154
Appendix
G
Demo PLC Code
1.
Deactivate all Controls and clear DataValid and Error status signals. This is a “best practice” measure, to ensure that the PLC has transitioned from a state of triggering and processing inspections, to issuing a command.
2.
If a job change command is to be issued, populate the output tags required to configure the new job (bool, int, long, float, string).
3.
Write the required CmdCode (see Read_MV_const_CmdCode_xxxx tags) and CmdArg, then activate ExeCmd.
4.
Wait for ExeCmd to go inactive (per typical demo mode 1 operation). Note that job changes can take up to a minute. While a job change command is being executed, the Status.State tag will be 2.
5.
When ExeCmd goes inactive, verify the following: Read_MV_CmdCodeRslt_last is 0 (Success) Read_MV_CmdRest_last contains the returned data from the command (if any) Status.State has changed to 0 (Offline) or 1 (Online) ExeCmdAck is inactive (0) Status.Error is inactive (0)
6.
G-10
Put the camera online (if necessary), and continue with normal runtime operation.
VS-06 Smart Camera Guide
Page 155
VS-06 Specific Status Guidelines
G
Online
Demo PLC Code
The camera cannot be Triggered or generate Inspection data unless Online is active. See the GoOnline Control. TriggerReady Do not attempt to trigger the camera unless TriggerReady is active. See the description of the Trigger for more details. TriggerAck and ResetCountAck Used by the demo code to complete the respective operations. VS-06 DataValid When DataValid goes active, the user app should process the Inspection data, then clear DataValid using the ResetDataValid control. This is handled, by the demo code in mode 1 and 2, as a demonstration for the user app. If the camera’s DataValid goes active, but the user app has not cleared a previous DataValid event, the demo code does not overwrite Read_MV_IO_user with new Inspection data. Instead, the demo code increments the counter Read_MV_dv_err_count. The new Inspection data remains stranded in the Read_MV_internal tag set, and is effectively lost.
Read_MV_trigger_count Incremented by the demo code when a new trigger is issued to the camera over the EtherNet/IP interface (Trigger Control activated).
Read_MV_trigger_err_count Incremented by the demo code if the user app attempts to trigger the camera when TriggerReady is not active.
VS-06 Smart Camera Guide
G-11
Page 156
Appendix
G
Demo PLC Code
Read_MV_dv_err_count Incremented by the demo code when new Inspection data is received from the camera, but the user app has not cleared the previous DataValid.
Read_MV_status_err_count Incremented by the demo code whenever the Error Status goes active.
Read_MV_demo_blob, Read_MV_demo_decode, Read_MV_demo_InspStat, Read_MV_demo_measure Purpose These tags record counts and min and max values of several EIP IN data members. The demo code expects a demo vision job to be loaded on the camera, and a demo target to be in the camera’s field of view. The demo PLC code will operate without the demo vision job being loaded on the camera. However, the data records will not be valid. The demo vision job has the following data members linked to certain job tools: IN Bool1 = Measure status (pass/fail) Bool2 = Decode+Matchcode status (pass/fail) Bool3 = Blob count status (pass fail) Long1 = Blob count Float1 = Measure value String1 = Decode text OUT Long101 = Blob count minimum count tolerance Long102 = Blob count maximum count tolerance
G-12
VS-06 Smart Camera Guide
Page 157
Float101 = Measure lower tolerance
G
Float102 = Measure upper tolerance
Demo PLC Code
String101 = Matchcode Each tag set records the following data for each vision job tool result received in the Inspection report:
VS-06 Smart Camera Guide
G-13
Page 158
Appendix
G
Demo PLC Code
User App Method The user app can follow the demo code’s usage of these tags for further application logic development. During runtime, the user app can change the OUT data members, and observe the change in tool status after a new trigger. Specifically, the PLC integrator would typically modify the logic beginning at the following rungs:
Demo Target The demo vision job uses predefined images. It is unnecessary to have the camera aimed at any specific target. If preferred, the job can be changed to enable the camera’s image sensor. In this case, the demo targets should be printed approximately 2.5 inches (63 mm) wide by 1.6 inches (40 mm) tall, centered on white paper larger than the camera’s field of view, and presented to the camera with the Data Matrix symbol on the right: “Pass” Image
G-14
VS-06 Smart Camera Guide
Page 159
“Fail” Image
Demo PLC Code
G
Demo Code Usage The user app example of the demo code watches for Data Valid. When it goes active, the user app example processes the user IO data, updates each demo record with the results, then uses ResetDataValid to clear DataValid.
Read_MV_IO_internal, Read_MV_ons_internal Purpose Used by the demo code to manage the camera. User App Method None. The user app must not attempt to read or write to this tag set. Demo Code Usage The demo code uses this tag set to abstract the on-the-wire control of the camera from the user app.
Run the Camera: Runtime Operation of EtherNet/IP Demo At this point in the evaluation, it is assumed that you have downloaded the demo vision job to the camera, your PLC is running the EIP demo code and is exchanging data with the camera. The PLC can now parameterize, trigger and monitor the camera over EtherNet/IP.
VS-06 Smart Camera Guide
G-15
Page 160
Appendix
G-16
G
Demo PLC Code
VS-06 Smart Camera Guide