![Mitsubishi MELFA 4D-2CG5100-PKG-E Instruction Manual Download Page 117](http://html1.mh-extra.com/html/mitsubishi/melfa-4d-2cg5100-pkg-e/melfa-4d-2cg5100-pkg-e_instruction-manual_1808016117.webp)
9
Detailed Explanation of Functions
Vision Sensor Dedicated Commands and Status Variables
9-106
(3) P_NVS1 - P_NVS8
[Function]
Stores the data recognized by the vision sensor in position data format.
In an NVPST command or NVIN command, when a <type> of "0" is specified, the data in the cell range
specified with <Start cell> - <End cell> is stored as the X, Y, and C coordinates.
In an NVPST command or NVIN command, data must be stored in the order X, Y, C in the cells specified
with <Start cell> - <End cell>.
Example:
In the above vision program, when "J96" and "L98" are specified in the <Start cell> and <End cell> of the
NVPST command or NVIN command, P_NVS1() becomes the following values.
P_NVS1(1)=(+347.14 , -20.23 , +0.00 , +0.00 , +0.00 , -158.19 , +0.00, +0.00)(0 , 0)
P_NVS1(2)=(+381.28 , +49.01 , +0.00 , +0.00 , +0.00 , +10.84 , +0.00, +0.00)(0 , 0)
P_NVS1(3)=(+310.81 , +43.65 , +0.00 , +0.00 , +0.00 , -34.312 , +0.00, +0.00)(0 , 0)
P_NVS1(4)=( +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00, +0.00)(0 , 0)
P_NVS1(5)=( +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00, +0.00)(0 , 0)
・・・・・・・
P_NVS1(30)=( +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00 , +0.00, +0.00)(0 , 0)
[Array element count]: 30
The maximum number of pieces of work that a vision sensor can recognize at one time is 255, but the
maximum number of sets of work information that a robot can acquire is 30.
[Sample sentence]
100 IF M_NVOPEN(1)<>1 THEN 'If vision sensor number 1 log on is not complete
110 NVOPEN “COM2:” AS #1 'Connects with the vision sensor connected to COM2.
120 ENDIF
130 WAIT M_NVOPEN(1)=1 ' Connects with vision sensor number 1 and waits for logon to be
completed.
140 NVPST #1,”TEST”,”E76”,”J96”,”L98”,0,10
'Starts the "Test" program, receives the recognition count from the E76 cell and the recognition results
from cells J96 through L98, and stores this in P_NVS1().
150 MVCNT=M_NVNUM(1) 'Acquires the number of pieces of work recognized by the vision sensor.
330 FOR MCNT=1 TO MVCNT 'Repeated once for each piece of work recognized
340 P10=P1 'Copies the reference position P1 to target position P10.
350 P10=P10*P_NVS1(MCNT) 'Corrects the difference from the reference work for the recognized work
and substitutes it in P10.
360 MOV P10,-50 'Moves to above the first recognized piece of work.
370 MVS P10 'Moves to the position of the first recognized piece of work.
380 HCLOSE 1 'Grasps the work.
390 MVS P10,-50 'Moves to above the first recognized piece of work
400 NEXT MCNT