Function Block Example Reference for QnUDEH Module Application Note-En
Transcript of Function Block Example Reference for QnUDEH Module Application Note-En
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
1/77
FB Library Reference Manual for In-Sight CPU with Built-in Ethernet Port Connection
Reference Manual Revision History.................................................................................................................................. 1
1 Outline..................................................................................................................................................................... 2
11 FB Library Outline................................................................................................................................................ 2
12 FB Library Function Contents............................................................................................................................... 2
13 System Configuration Example............................................................................................................................ 3
14 Settings for the CPU Unit w/ Built-in Ethernet Port ............................................................................................... 4
141 Operation Settings for the CPU Unit w/ Built-in Ethernet Port ........................................................................... 4
142 Open Settings for the CPU Unit w/ Built-in Ethernet Port.................................................................................. 5
15 Settings for the QJ71E71-100 Ethernet Unit......................................................................................................... 6
151 Operation Settings for the QJ71E71-100 Ethernet Unit .................................................................................... 6
152 Initial Settings for the QJ71E71-100 Ethernet Unit............................................................................................ 7
153 Open Settings for the QJ71E71-10 Ethernet Unit ............................................................................................. 8
16 Essential Cognex EasyBuilder Settings for Using FB......................................................................................... 9
17 Startup Check Method For In-Sight from Personal Computers Using Windows.............................................. 10
18 Related manuals.................................................................................................................................................11
19 Important ............................................................................................................................................................11
2 FB Library Details .................................................................................................................................................. 12
21 P+Cognex-In-Sight_LogOn (Establish Connection with Vision System) .............................................................. 12
22 P+Cognex-In-Sight_LoadJob (Selects, Changes and Activates Jobs)................................................................. 17
23 P+Cognex-In-Sight_TriggerAcq (Acquisition of Image Assessment Results)....................................................... 2224 P+Cognex-In-Sight_GetData (Value Acquisition of Symbolic Tags)..................................................................... 26
25 P+Cognex-In-Sight_SetData (Value Change of Symbolic Tags).......................................................................... 31
26 P+Cognex-In-Sight_GetStatus (Online/Offline Acquisition) ................................................................................. 36
27 P+Cognex-In-Sight_SetOnline (Puts the In-Sight Vision System Online).......................................................... 40
28 P+Cognex-In-Sight_SetOffline (Takes the In-Sight Vision System Offline)........................................................ 44
29 P+Cognex-In-Sight_SaveJob (Save the Operation Job in Flash Memory) .......................................................... 48
210 P+Cognex-In-Sight_SendCmd (Native Command Send).................................................................................... 53
3 Appendix ............................................................................................................................................................... 58
31 Using Passwords to Prevent Reading/Writing in Ladder Programs..................................................................... 58
32 Finding Out which Symbolic Tags can be Used with an FB................................................................................. 61
33 Type Conversion Processing Combination Table for P+Cognex-In-Sight_GetData.............................................. 62
34 Type Conversion Processing Combination Table of P+Cognex-In-Sight_SetData ............................................... 62
35 Usable Native Commands That Can Be Sent With P+Cognex-In-Sight_SendCmd............................................. 63
4 Example of Using the FB Library............................................................................................................................ 65
41 Example of Operating In-Sight With Sequencer............................................................................................... 65
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
2/77
Reference Manual Revision History
Version Revised
Date
Revision Contents
v1.00A 2009/02/20 Newly created
v1.01B 2009/06/01 1. Change due to a language review of the entire sentence
I/O address -> XY address
2. Corrections due to XY address range check processing change
All FBs: Error Code -100 Definition deletion
All FBs: Description change to the Valid range item in the "Unit installation
XY address input label
3. Corrections due to connection No. range check processing change
All FBs: Error Code -101 Definition deletion
All FBs: Error Code -102 Language correction
All FBs: Error Code -104 Language correction
All FBs: Error Code -105 Language correction
All FBs: Error Code -106 Language correction
v1.02C 2009/10/02 Correction of the number of connected units described in 1.3 System Configuration
v1.03D 2009/12/01 1. Description addition of L series CPU in 1.1 FB Library Outline.
2. 1.2 FB Library Function Contents were corrected as follows.
For P+Cognex-In-Sight_LogOn, QnUCPU w/ built-in Ethernet was changed
to CPU w/ built-in Ethernet port.
3. Language of 1.4: QnUCPU w/ built-in Ethernet was changed to CPU w/ built-in
Ethernet port.
4. FB Library Details - Description of Function: Corrected as follows.
All FBs: Target unit was changed from QnUCPU w/ built-in Ethernet to
CPU w/ built-in Ethernet port.
All FBs: L series CPU added to the target CPU.
All FBs: L series added to the GX Works2 version.
All FBs: Description of the input conditions for FB_EN deleted.
All FBs: FB operation: Pulse execution type (multiple scans) added.
5. FB Library Details - Input Labels: Changed as follows.
All FBs: Explanation for unit installation XY address changed to the
explanation for CPU w/ built-in Ethernet port.
6. FB Library Details - Related manuals: MELSEC-L CPU Users Manual added.
7. FB Library Details - Connection Destination Settings: Corrected as follows.
P+Cognex-In-Sight_LogOn: CPU w/ built-in Ethernet changed to CPU
w/ built-in Ethernet port.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
3/77
Outline
FB Library Outline
This FB library connects to Cognex CorporationIn-Sight Vision Systems by using the QCPU w/ built-in Ethernet port
and LCPU (hereinafter, referred to as CPU w/ built-in Ethernet port) and ethernet unit QJ71E71-100.
FB Library Function Contents
No. Item Description
1 P+Cognex-In-Sight_LogOn Establishes the connection between the CPU w/ built-in Ethernet port,
QJ71E71-100 module and the In-Sight Vision System.
2 P+Cognex-In-Sight_LoadJob Selects, changes and makes active jobs stored in the In-Sight Vision System.
3 P+Cognex-In-Sight_TriggerAcq After triggering loading of the In-Sight Vision System images, acquires the
result of the image assessment (pass / no pass).
4 P+Cognex-In-Sight_GetData Acquires the data held by In-Sight.
5 P+Cognex-In-Sight_SetData Changes the data held by In-Sight.
6 P+Cognex-In-Sight_GetStatus Acquires the current status of the In-Sight Vision System (online/offline).
7 P+Cognex-In-Sight_SetOnline Puts the In-Sight Vision System online.
8 P+Cognex-In-Sight_SetOffline Takes the In-Sight Vision System offline.
9 P+Cognex-In-Sight_SaveJob Saves the current job to the In-Sight Vision Systems flash memory.
10 P+Cognex-In-Sight_SendCmd Sends the selected native command and receives the results.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
4/77
System Configuration Example
In the Q series, the configuration is as follows. The system configuration is the same for the L series as well.
*1. Regarding the number of devices connected to an In-Sight Vision System
[CPU w/ built-in Ethernet port]
For using communication by FB and not using MC protocol: 16 devices or less (1 port is used for sending and receiving per
device)
For using communication by FB using MC protocol: 8 devices or less (2 ports are used per device, for sending and
receiving and for MC protocol)
[QJ71E71-100 module]
For using communication by FB and not using MC protocol: 8 devices or less (2 ports are used for sending and receiving
per device)
For using communication by FB using MC protocol: 5 devices or less (3 ports are used per device, for sending, for
receiving and for MC protocol)
No. Device Name Explanation
1 Q series sequencer Use base, power supply unit and QnUCPU unit w/ built-in Ethernetwith Serial Nos. with the first 5 digits of 11012 or later.
2 GX Works2 Use Version 1.09K or later
3 QJ71E71-100 Q series sequencer ethernet unit
4 Cognex In-Sight series In-Sight Vision System
Connecting multiple devices with In-Sight is possible using an
ethernet hub.1
5 PoE (Power over Ethernet) Unit Power is supplied to the Cognex In-Sight series via an ethernet
cable.
Power can also be supplied using methods other than an ethernet
cable.
6 Ethernet hub 100BASE-TX
compatible products
An ethernet hub is not essential. Operation is possible even with
system configurations directly connected to QnUCPU w/ built-inEthernet and ethernet units with the Cognex In-Sight series.
7 Windows personal computer Used when connecting to the In-Sight series using EasyBuilder.
8 Cognex EasyBuilder Version 4.3 Used when connecting with In-Sight and for programming settings.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
5/77
Settings for the CPU Unit w/ Built-in Ethernet Port
Operation Settings for the CPU Unit w/ Built-in Ethernet Port
This section explains the settings for CPU units w/ built-in Ethernet ports used by this program.
Use GX Works2 to program the following items.
(1) Your IP address Set the IP address of the ethernet unit as 192.168.0.2.
(2) Enable online change Check the checkbox.
The following diagram is from GX Works2.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
6/77
Open Settings for the CPU Unit w/ Built-in Ethernet Port
(1) Socket Communication settings
Select the connection No. that fits the system.
This will be the connection No. that is entered into the FB.
(a) Protocol Set to TCP.
(b) Open System Set to Socket Communication
(c) TCP connection Set to Active.
(d) Host Station Port No. Enter the hexadecimal number that matches the In-Sight setting.
(hexadecimal number) (Refer to 1.6) The default setting is 0017.
(e) Destination IP address Enter the decimal number that matches the In-Sight setting. (Refer to 1.6)
The destination IP address is 192.168.0.1.
(f) Destination Port No. Enter the hexadecimal number that matches the In-Sight setting.
(hexadecimal number) (Refer to 1.6) The default setting is 0017.
(2) MC Protocol settings
(a) Protocol Set to TCP.(b) Open System Set to MC Protocol.
(c) TCP Connection No setting is required.
(d) Host Station Port No. Enter the hexadecimal number that matches the In-Sight setting.
(hexadecimal number) (Refer to 1.6) The default setting is 3000.
(e) Destination IP address No setting is required.
(f) Destination Port No. No setting is required.
Use GX Works2 to program the 2 Connection Open settings.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
7/77
Settings for the QJ71E71-100 Ethernet Unit
Operation Settings for the QJ71E71-100 Ethernet Unit
This section explains the QJ71E71-100 settings used by this program.
Use GX Works2 to program the following items.
(1) Start I/O No. Enter in accordance with the installation unit No.
When installing in slot 0, set 0000.
(2) Network No. Enter in accordance with the network configuration.
Set to 1.
(3) Station No. Enter in accordance with the network configuration.
Set to 1.
(4) Your IP address Set the IP address of the ethernet unit.
It is set to 192.168.0.3 in this program.
(5) Initial timing setting Select Always wait for OPEN (Communication possible at STOP time).
(6) Enable Online Change Check the checkbox.
The following screenshot is from GX Works2.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
8/77
Initial Settings for the QJ71E71-100 Ethernet Unit
Existing set values for the QJ71E71-100 can be changed by setting the following items.
Dest. Confirmation Start Interval
Dest. Confirmation Interval
Dest. Confirmation Resend
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
9/77
Open Settings for the QJ71E71-10 Ethernet Unit
Use GX Works2 to program the 3 Connection Open settings.
(1) TCP Communication Settings
Select the connection No. that fits the system.
This will be the connection No. that is entered into the FB.
(a) Protocol Set to TCP.(b) Open System Set to Active.
(c) Fixed Buffer Communication Procedure Set to No Procedure.
(d) Pairing Open Set to Enable.
(e) Existence Confirmation Set to Confirm.
(f) Host StationPort No. Enter the hexadecimal number that matches the In-Sight setting.
(hexadecimal number) (Refer to 1.6) Enter 0BB8.
(g) Destination IP Address Enter the decimal number that matches the In-Sight setting.
(Refer to 1.6) Enter 192.168.0.1.
(h) Destination Port No. (hexadecimal number) Enter the hexadecimal number that matches the In-Sight setting.
(Refer to 1.6) Enter 0BB8.
(2) Connection No.3 (For MC protocol reception)
(a) Protocol Set to TCP.
(b) Open System Set to Unpassive.
(c) Fixed Buffer Set to Receive.
(d) Fixed Buffer Communication Procedure Set to Procedure Exist.
(e) Pairing Open Set to Disable.
(f) Existence Confirmation Set to Confirm.
(g) Host Station Port No. Enter the hexadecimal number that matches the In-Sight setting.
(hexadecimal number) (Refer to 1.6) The default setting is 3000.(h) Destination IP address No setting is required.
(i) Destination Port No. No setting is required.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
10/77
Essential Cognex EasyBuilder Settings for Using FB
This section explains the CognexIn-Sight settings used by this program.
Set the job file settings and the network setting.
For details, refer to In-Sight EasyBuilder Help.
Use EasyBuilder to program the following network settings.
(1) IP Address Set the IP address of Cognex In-Sight to 192.168.0.1 so the IP address
settings of sequencer CPU in In-Sight EasyBuilder do not overlap.
(2) Subnet Mask Set the subnet mask in In-Sight EasyBuilder to 255.255.255.0.
(3) Telnet Port No. (decimal number) When connecting with the CPU w/ built-in Ethernet port, set to 23 in
In-Sight EasyBuilder.
When connecting with the QJ71E71-100, set to 3000 in In-Sight
EasyBuilder.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
11/77
Startup Check Method For In-Sight from Personal Computers Using Windows
Use Command Prompt in Windows to check the startup of In-Sight by sending a ping.
(1) Click Start and select Run.
(2) In the Run dialog box, enter cmd and press the OK button.
(3) Enter the following command in Command Prompt to check the startup of In-Sight from the displayed response.
Ping 192.168.0.1
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
12/77
Related manuals
MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
Important
Be sure to read the corresponding Users Manual before using each product.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
13/77
FB Library Details
P+Cognex-In-Sight_LogOn (Establish Connection with Vision System)
Name
P+Cognex-In-Sight_LogOn
Description of Function
Item Description
Summary of Function Establishes the connection between the CPU w/ built-in Ethernet port, QJ71E71-100 module
and the In-Sight Vision System.
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 1412
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, logs on to In-Sight from the ethernet unit.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
14/77
Item Description
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
I/O Signal Movement [With normal end]
[ExecutionCommand]
[Execution
Status]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[ExecutionCommand]
[Execution
Status]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. When this FB is used, the connection destination must be set in advance in the open setting
of the network parameter. Refer to the Users Manual and be sure to complete the settings.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
15/77
Error Codes
Error Code List
Error Code Description Action
-102
Connection Open failed. Perform the operation again after checking whether
the connection No. for the FB input label is not outside
the acceptable range and whether the connection
destination settings in GX Works2 are correct.
-103 Connection Open failed. The corresponding connection is already open.
-104A communication error occurred. Invalid data was received. Perform the operation again
after checking the line status and the ladder program.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-200Logon to In-Sight failed with the entered
user name and password.
Re-confirm the user name and password.
-201The length of the user name exceeds 15
characters.
The user name must be 15 characters or less.
-202The length of the password exceeds 15
characters.
The password must be 15 characters or less.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
16/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specify the connection No. set
in the network parameter.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 is
entered, the value will be
automatically set to 30
(seconds).
User Name1,2
i_UserName Text
string
[0 to 9] [a to z]
[A to Z]
Enter a user name of 15
characters or less that can log
on to In-Sight.
If no entry is made, operator
is automatically entered.
Password1,2
i_Password Text
string
[0 to 9] [a to z]
[A to Z]
Enter a password of 15
characters or less for the user
name.
If no entry is made, the
password is sent as No
Password to In-Sight.
1: Use ASCII or Shift-JIS characters for the User name and Password input variables.
2: Passwords can be used in ladder programs to prevent reading of the User name and Password.
Refer to 3.1 Using Passwords to Prevent Reading/Writing in Ladder Programs.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
17/77
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for the
abnormal result.
Connection Destination Settings
For operating In-Sight, the connection destination of the CPU w/ built-in Ethernet port and QJ71E71-100 module must be
set.
Set the corresponding connection destination of In-Sight from the PC parameter and network parameter
Ethernet/CC IE/MELSECNET for GX Works2.
Be sure to read 1.4 and 1.5 in this manual for the setting method.
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
18/77
P+Cognex-In-Sight_LoadJob (Selects, Changes and Activates Jobs)
Name
P+Cognex-In-Sight_LoadJob
Description of Function
Item Description
Summary of Function Selects, changes and activates jobs stored in the In-Sight Vision System.
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 1356
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (Execution Command) ON, selects, changes and activates jobs stored in the
In-Sight Vision System.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
19/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. In this FB, there is processing for going offline and online before and after job change
processing.
It is, therefore, not necessary to separately use FBs that execute offline and online
commands.
4. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
20/77
Error Codes
Error Code List
Error Code Description Action
-1The specified value is outside the range or
is not a valid integer.
Refer to the In-Sight manual.
-2 The command could not be executed. Refer to the In-Sight manual.
-4In-Sights sensor does not have
sufficient memory.
Refer to the In-Sight manual.
-5 The system is not online. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-300
The length of the job file name to be
changed is not between 1 and 32
characters.
Enter a job file name of between 1 and 32 characters,
including the extension.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
21/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 isentered, the value will be
automatically set to 30
(seconds).
Selected job file name1 i_JobFileName Text
string
[0 to 9] [a to z]
[A to Z]
Specifies the job file name
already saved in In-Sight
(1 to 32 characters).
1: Use ASCII or Shift-JIS characters for the Selected job file name input variable.
Output labelsName Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for the
abnormal result.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
22/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
23/77
P+Cognex-In-Sight_TriggerAcq (Acquisition of Image Assessment Results)
Name
P+Cognex-In-Sight_TriggerAcq
Description of Function
Item Description
Summary of Function After triggering loading of the In-Sight Vision System images, acquires the result of the image
assessment (pass / no pass).
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 1652
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, triggers loading of the In-Sight Vision System images
and then acquires the result of the image assessment (pass / no pass).
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
24/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
Error Codes
Error Code List
Error Code Description Action
-2 The command could not be executed. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-104A communication error occurred. Invalid data was received. Perform the operation again
after checking the line status and the ladder program.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sightcommand been executed (excluding LogOn)?
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
25/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the correspondingCPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 isentered, the value will be
automatically set to 30
(seconds).
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
Execution result o_Result Word 0 -1: Pass/no pass statusacquisition failure
0: Image assessment result is
no pass
1: Image assessment result is
no pass
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for theabnormal result.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
26/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
27/77
P+Cognex-In-Sight_GetData (Value Acquisition of Symbolic Tags)
FB Definition Name
P+Cognex-In-Sight_GetData
Description of Function
Item Description
Summary of Function Acquires the data held by In-Sight.
Symbol
* When the symbolic tag name is unknown, refer to 3.2 Finding Out which Symbolic Tags can
be Used with an FB.
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 1512
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
28/77
Item Description
Explanation of
Function
With FB_EN (execution command) ON, sends the symbolic tag set in i_tag to the In-Sight
Vision System, and acquires the value.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
I/O Signal Movement [With normal end]
[Execution
Command]
[Execution
Status]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[Execution
Status]
[Normal
Completion]
[AbnormalCompletion]
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
4. Be sure to match the type of value received with i_Result_Type.
When the type does not match, a CPU operation error may occur when the type is converted.
For details refer to "3.3 Type Conversion Processing Combination Table for
P+Cognex-In-Sight_GetData".
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
29/77
Error Codes
Error Code List
Error Code Description Action
-1The specified value is outside the range or
is not a valid integer.
Refer to the In-Sight manual.
-2 The command could not be executed. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-104A communication error occurred. Invalid data was received. Perform the operation again
after checking the line status and the ladder program.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-301The length of the symbolic tag name is not
between 1 and 32 characters.
Enter a symbolic tag name of between 1 and 32
characters.
-305 The set data type is not between 0 and 4. Set the data type to between 0 and 4.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
30/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number
to specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767 (decimal
number)
Enter the length of the
timeout (in seconds) when
communication with
In-Sight is broken.
If no entry is made, or a
negative number or 0 is
entered, the value will beautomatically set to 30
(seconds).
Symbolic tag1 i_tag Text string [0 to 9] [a to z]
[A to Z]
Sets the transmitted symbolic
tag to between 1 to 32
characters.
Data type of the received value2 i_Result_Type Word 0 to 4 (decimal
number)
Specifies the data type of the
received value for the
symbolic tag.
0: Text string
1: 16 bit integer (0 or 1)
2: 16 bit integer
3: 32 bit integer
4: Single-precision real
number (32 bits)
1: Use ASCII or Shift-JIS characters for the Symbolic tag input variable.
2: For the type conversion operation of the received value data type and received data, refer to 3.3 Type Conversion
Processing Combination Table for P+Cognex-In-Sight_GetData.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
31/77
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
Execution result o_Result Text string
16 bit integer
32 bit integer
Single-
precision real
number
0 The result for the sent
symbolic tag will be saved.
For a text string, a maximum
of 255 characters is stored.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for the
abnormal result.
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
32/77
P+Cognex-In-Sight_SetData (Value Change of Symbolic Tags)
1. Name
Name
P+Cognex-In-Sight_SetData
Description of Function
Item Description
Summary of Function Changes the data held by In-Sight.
Symbol
* When the symbolic tag name is unknown, refer to
3.2 Finding Out which Symbolic Tags can be Used with an FB.
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
33/77
Item Description
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 2323
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, sends a random symbolic tag to the In-Sight Vision
System, and sets the value.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
I/O Signal Movement [With normal end]
[Execution
Command]
[Execution
Status]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[Execution
Status]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. In this FB, there is processing for going offline and online before and after data change
processing.
It is, therefore, not necessary to separately use FBs that execute offline and online commands.
4. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
5. Do not directly enter the value for i_tag_Value and i_tag_Data_Type.
Create the MAIN program so it refers to the values stored in D300, etc.
When the values are entered directly, an operation CPU error may occur.
6. Be sure to match the type of i_tag_Data_Type with i_tag_Value.When the type does not match, an operation CPU error may occur when the type is
converted.
For details, refer to 3.4 Type Conversion Processing Combination Table for
P+Cognex-In-Sight_SetData.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
34/77
Error Codes
Error Code List
Error Code Description Action
-1The specified value is outside the range or
is not a valid integer.
Refer to the In-Sight manual.
-2 The command could not be executed. Refer to the In-Sight manual.
-5 The system is not online. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-104A communication error occurred. Invalid data was received. Perform the operation again
after checking the line status and the ladder program.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-301The length of the symbolic tag name is not
between 1 and 32 characters.
Enter a symbolic tag name of between 1 and 32
characters.
-302The set value length is not between 1 and
32 characters.
Enter a set value length of between 1 and 32
characters.
-305 The set data type is not between 0 and 4. Set the data type to between 0 and 4.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
35/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY
address
i_Start_IO_No Word Depends upon the
range of I/O points in
the corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address set in
the corresponding Ethernet unit.
(For example, enter H10 in the
case of X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767 (decimal
number)
Enter the length of the timeout (in
seconds) when communication
with In-Sight is broken.
If no entry is made, or a negative
number or 0 is entered, the
value will be automatically set to
30 (seconds).
Symbolic tag i_tag Text string [0 to 9] [a to z]
[A to Z]
Sets the transmitted symbolic tag
to between 1 to 32 characters.
Set value1,2
i_tag_Value Text string
16 bit integer
32 bit integer
Single-
precision real
number
--- Sets the value specified in the
data type of the set value.
When saving a text string, enter
between 1 and 32 characters.
Data type of the set
value2
i_tag_Data_Type Word 0 to 4 (decimal
number)
Specifies the data type of the
transmitted value.
0: Text string (1 to 32 characters)
1: 16 bit integer (0 or 1)
2: 16 bit integer
3: 32 bit integer
4: Single-precision real number
(32 bits)
1: Use ASCII or Shift-JIS characters for the Symbolic tag and Set value (when the set value data type is a text string)
input variables.
2: Refer to 3.4 Type Conversion Processing Combination Table for P+Cognex-In-Sight_SetData for the type conversion
operation of the set value data type and set values.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
36/77
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
Execution result o_Result Word 0 0: Setting not complete.
1: Setting complete.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for the
abnormal result.
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
37/77
P+Cognex-In-Sight_GetStatus (Online/Offline Acquisition)
Name
P+Cognex-In-Sight_GetStatus
Description of Function
Item Description
Summary of Function Acquires the current status of the In-Sight Vision System (online/offline).
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 700
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, acquires the current status of the In-Sight Vision
System (online/offline).
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
38/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
Error Codes
Error Code List
Error Code Description Action
-2 The command could not be executed. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
39/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 is
entered, the value will be
automatically set to 30
(seconds).
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
Execution result o_Result Word 0 0: Offline
1: Online
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code for the
abnormal result.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
40/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
41/77
P+Cognex-In-Sight_SetOnline (Puts the In-Sight Vision System Online)
Name
P+Cognex-In-Sight_SetOnline
Description of Function
Item Description
Summary of Function Puts the In-Sight Vision System online.
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 697
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, puts the In-Sight Vision System online.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
42/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
Error Codes
Error Code List
Error Code Description Action
-2 The command could not be executed. Refer to the In-Sight manual.
-5 The system is not online. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
43/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 is
entered, the value will be
automatically set to 30
(seconds).
Output labels
Name Variable name Data type Default DescriptionExecution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
44/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
45/77
P+Cognex-In-Sight_SetOffline (Takes the In-Sight Vision System Offline)
Name
P+Cognex-In-Sight_SetOffline
Description of Function
Item Description
Summary of Function Takes the In-Sight Vision System offline.
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 688
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, takes the In-Sight Vision System offline.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
46/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
Error Codes
Error Code List
Error Code Description Action
-2 The command could not be executed. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
47/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 is
entered, the value will be
automatically set to 30
(seconds).
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
48/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
49/77
P+Cognex-In-Sight_SaveJob (Save the Operation Job in Flash Memory)
Name
P+Cognex-In-Sight_SaveJob
Description of Function
Item Description
Summary of Function Saves the current job to the In-Sight Vision Systems flash memory.
Symbol
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision
System
Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 1351
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, saves the current job to the In-Sight Vision Systems
flash memory.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
50/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. In this FB, there is processing for going offline and online before and after save processing.
It is, therefore, not necessary to separately use FBs that execute offline and online
commands.
4. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
51/77
Error Codes
Error Code List
Error Code Description Action
-2
The command could not be executed
because saving the job failed, In-Sight
was online, or the file was not found.
Refer to the In-Sight manual.
-5 The system is not online. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-303The length of the job file name to be saved
is not between 1 and 32 characters.
Enter a job file name of between 1 and 32 characters,
including the extension.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
52/77
Labels
Input Labels
Name Variable name Data type Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address
set in the corresponding
Ethernet unit. (For example,
enter H10 in the case of
X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is
selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout
(in seconds) when
communication with In-Sight
is broken.
If no entry is made, or a
negative number or 0 isentered, the value will be
automatically set to 30
(seconds).
Save job file name1 i_JobFileName Text
string
[0 to 9] [a to z]
[A to Z]
Specifies a job file name to be
saved in In-Sight of between
1 and 32 characters.
1: Use ASCII or Shift-JIS characters for the Save job file name input variable.
Output labelsName Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
53/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
54/77
P+Cognex-In-Sight_SendCmd (Native Command Send)
Name
P+Cognex-In-Sight_SendCmd
Description of Function
Item Description
Summary of Function Sends the selected native command and receives the results.
Symbol
* When the native command to be sent is unknown, refer to 3.5 Usable Native Commands that
can be sent with P+Cognex-In-Sight_SendCmd.
Compatible units CPU w/ built-in Ethernet port, QJ71E71-100 module
Compatible Vision System Cognex In-Sight
Compatible CPU
Series Model
MELSEC-Q Series QCPU w/ built-in Ethernet port*
MELSEC-L Series LCPU
* Serial Nos. with the first 5 digits of 11012 or later.
Compatible Devices
GX Works2 Q Series CPU: Version 1.09K or later
L Series CPU: Version 1.20W or later
Language Ladder
No. of Steps (Max.) QCPU w/ built-in Ethernet port: 778
* The number of steps is indicated as a reference for the number of steps in the label program.
For details, refer to GX Works2 Version 1 Operating Manual (Simple Project Edition).
Explanation of
Function
With FB_EN (execution command) ON, sends and receives a random native command.
FB Compile Method Macro type
FB Operation Pulse execution type (multiple scans)
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
55/77
Item Description
I/O Signal Movement [With normal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Completion]
[Error Code]
[With abnormal end]
[Execution
Command]
[ExecutionStatus]
[Normal
Completion]
[Abnormal
Com letion
[Error Code]
Constraints
(Cautions)
1. This FB does not include error processing. Error processing can be created separately to
match your system and operation requirements.
2. In order to use this FB, it is necessary to use P+Cognex-In-Sight_LogOn and log onto
In-Sight beforehand.
3. Do not implement multiple FBs simultaneously for the same camera; if necessary, execute
multiple FBs sequentially.
Related manuals MELSEC-L CPU Unit Users Manual (Built-in Ethernet Function Edition)
QnUCPU Users Manual (Built-in Ethernet Port Communication Edition)
Q-compatible Ethernet Interface Unit Users Manual (Basic Edition)
In-Sight EasyBuilder Help
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
56/77
Error Codes
Error Code List
Error Code Description Action
0 An unrecognizable command was sent. Refer to the In-Sight manual.
-1
The specified value is outside the range or
is not a valid integer.
Refer to the In-Sight manual.
-2 The command could not be executed. Refer to the In-Sight manual.
-4In-Sights sensor does not have
sufficient memory.
Refer to the In-Sight manual.
-5 The system is not online. Refer to the In-Sight manual.
-6
The user doesnt have the necessary
access privileges to execute the
command.
Refer to the In-Sight manual.
-105
A communication error occurred. Perform the operation again after checking whether
power has been disconnected to In-Sight or the
communications cable has been disconnected, etc.
-106
A communication error occurred. Perform the operation again after checking the
following.
1. Are multiple FBs running simultaneously?
2. Is the connection No. for the FB input label outside
the acceptable range, or has an end logon to In-Sight
command been executed (excluding LogOn)?
-304The length of the native command to be
sent is not between 1 and 199 characters.
Set the native command to be sent to between 1 and
199 characters.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
57/77
Labels
Input Labels
Name Variable name Data
type
Valid range Description
Execution command FB_EN Bit --- ON: Run the FB.
OFF: Do not run the FB.
Unit installation XY address i_Start_IO_No Word Depends upon the
range of I/O points
in the
corresponding
CPU unit.
For the specific
range, refer to the
Users Manual for
the corresponding
CPU.
Use a hexadecimal number to
specify the first XY address set in
the corresponding Ethernet unit.
(For example, enter H10 in the
case of X10.)
Enter H0FFFF if a CPU with
built-in Ethernet port is selected.
Connection No. i_Connection_No Word 1 to 16 (decimal
number)
Specifies the connection No.
logged onto using
P+Cognex-In-Sight_LogOn.
Timeout value i_TimeOut Word 1 to 32767
(decimal number)
Enter the length of the timeout (in
seconds) when communication
with In-Sight is broken.
If no entry is made, or a negative
number or 0 is entered, the
value will be automatically set to
30 (seconds).
Native command1 i_Native_Command Text
string
[0 to 9] [a to z]
[A to Z]
Enter an arbitrary native
command to be sent (between 1
and 199 characters).
1: Use ASCII or Shift-JIS characters for the Native command input variable.
Output labels
Name Variable name Data type Default Description
Execution status FB_ENO Bit OFF ON: The FB is running.
OFF: The FB is not running.
Execution result o_Result Text
string
The result of the sent arbitrary
native command is saved as
255 characters or less.
End flag FB_OK Bit OFF ON: The FB ended normally.
OFF: The FB did not end.
Abnormal end flag FB_ERROR Bit OFF ON: Abnormal FB end.
OFF: The FB did not end.
Error Code ERROR_ID Word 0 Returns the error code.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
58/77
FB Version Update History
Important
This chapter describes the function of the function block.
It does not describe the constraints of using the unit or sequencer CPU nor the constraints generated by their combination,
etc.
Be sure to read the corresponding Users Manual before using each product.
Version Date Description
1.00A 2009/02/20 Newly created
1.01B 2009/06/01 XY address range check processing change
Connection No. range check processing change
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
59/77
Appendix
Using Passwords to Prevent Reading/Writing in Ladder Programs
Reading and writing in the ladder program can be prohibited by setting a password for the program.
The password can be used as a reading prevention measure for confidential data (user names, passwords, etc.) written in
the ladder program.
(1) Press Online, select Password/Keyword and then New.
(2) Select the program to set the password, and press Setting.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
60/77
(3) Set Read/Write Protection in Registration Condition and, after the password is set, click the OK button.
(4) Confirm that the Registration shows Registered, and click the OK button.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
61/77
(5) Whether or not the password is set can be confirmed by the Disable password prompt displayed during the Read
from PLC operation after the completion of password registration.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
62/77
Finding Out which Symbolic Tags can be Used with an FB
Communication for the application step in In-Sight EasyBuilder.
MC Protocol of communication.
The name of the symbolic tag can be checked by selecting the format input (output) data tab and clicking the Add button.
-
7/26/2019 Function Block Example Reference for QnUDEH Module Application Note-En
63/77
Type Conversion Processing Combination Table for P+Cognex-In-Sight_GetData
P+Cognex-In-Sight_GetData converts and outputs the value received from In-Sight in accordance with the specified
received value data type (i_Result_Type).
Whether or not settings are possible for the received value data type and the value received from In-Sight is shown below
along with the operation for the set values.
Type of Tag
Data Type ofReceived Value
Operation 2
Operation 2
Operation 2
Operation 2
Operation 1
Operation 1
Operation 1
Operation 1
Error 1*1.
Operation 3
Error 1*1.
Error 1*1.
Error 1*1.
Operation 4
Operation 4
Error 1*1.
Error 1*1.
Operation 5
Operation 5
Operation 5
: Setting Possible Error 1: CPU operation error occurred due to a value conversion failure
X: Setting not possible Operation 1: When the received value is "0", 0 is output When it is not "0", 1 is output
Operation 2: The numerical value is output as a text stringOperation 3: A 16 bit integer is output (Rounded off to one digit after the decimal point)
Operation 4: A 32 bit integer is output (Rounded off to one digit after the decimal point)
Operation 5: A single-precision real number (32 bits) is output
Numerical Value
Range
"0" or "1"
Single-precision Real Number
[32 bit](Enter K4)
Data Type of the Received Value
Not Entered
Text String (Enter KO)
16 bit integer [0 or 1](Enter K1)
16 bit integer (Enter K2)
32 bit integer (Enter K3)
Numerical Value Range
-3276832767
Numerical Value Range
-
2.147e+0092.147e+009
Numerical Value
Range
Other Ranges
Text String
Numerical Value
* For details of the conversion processing operation, refer to QCPU Programming Manual: Common Commands Edition.
Type Conversion Processing Combination Table of P+Cognex-In-Sight_SetData
P+Cognex-In-Sight_SetData converts the set value (i_tag_Value) to text string based on set value data type
(i_tag_Data_Type) and sends the set value to In-Sight.
Whether or not settings corresponding to the set value data type and the set value are possible and operation for the set
values are shown below.
Setting Value
Data Type of Direct Indirect Direct Indirect Direct Indire