![Mitsubishi MELFA 4D-2CG5100-PKG-E Скачать руководство пользователя страница 119](http://html1.mh-extra.com/html/mitsubishi/melfa-4d-2cg5100-pkg-e/melfa-4d-2cg5100-pkg-e_instruction-manual_1808016119.webp)
9
Detailed Explanation of Functions
Vision Sensor Dedicated Commands and Status Variables
9-108
(4) M_NVS1 - M_NVS8
[Function]
Stores the data recognized by the vision sensor in numeric data format.
In an NVPST command or NVIN command, when a <type> of "1" or "3" or “5” or “7” is specified, the data in
the cell range specified with <Start cell> - <End cell> is converted into numbers and stored.
Example:
In the above vision program, when "J96" and "Q98" are specified in the <Start cell> and <End cell> of
the NVPST command or NVIN command, the value of M_NVS1() becomes the following values.
Element 2
Element
1 1 2 3 4
5
6 7 8 9
1 347.147
-20.232
-158.198
97.641 0.0
110.141
120.141 72.645 0.0
2 381.288
49.018
10.846 97.048 0.0
89.582 99.582 -118.311
0.0
3 310.81
43.65 -34.312
0.0 0.0
139.151 149.151 -163.469
0.0
4 0.0 0.0 0.0
0.0 0.0
0.0 0.0 0.0 0.0
M_NVS1(
)
5 0.0 0.0 0.0
0.0 0.0
0.0 0.0 0.0 0.0
[Array element count]: (30.10)
It is possible to acquire 30 lines and 10 columns of information from all the cell information in the vision
program.
[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 and sets its
number as number 1.
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”,”Q98”0.1,10
'Starts the "Test" program, receives the recognition count from the E76 cell and the recognition results
from cells J96 through Q98, and stores this in M_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.
340 P10.X=M_NVS1(MCNT,1) 'Substitutes the X coordinate of the recognized work in the X
coordinate of P1.
350 P10.Y=M_NVS1(MCNT,2) 'Substitutes the Y coordinate of the recognized work in the Y
coordinate of P1.
360 P10.C=M_NVS1(MCNT,3) 'Substitutes the C coordinate of the recognized work in the C
coordinate of P1.
370 MOV P10,-50 'Moves to above the first recognized piece of work
380 MVS P10 'Moves to the position of the first recognized piece of work
390 HCLOSE 1 'Grasps the work.
400 MVS P10,-50 'Moves to above the first recognized piece of work
410 NEXT MCNT