![Mitsubishi MELFA 4D-2CG5100-PKG-E Скачать руководство пользователя страница 121](http://html1.mh-extra.com/html/mitsubishi/melfa-4d-2cg5100-pkg-e/melfa-4d-2cg5100-pkg-e_instruction-manual_1808016121.webp)
9
Detailed Explanation of Functions
Vision Sensor Dedicated Commands and Status Variables
9-110
(5) C_NVS1 - C_NVS8
[Function]
Stores the data recognized by the vision sensor in text string data format.
In an NVPST command or NVIN command, when a <type> of "2" or "3" or “6” or “7” is specified, the data in
the cell range specified with <Start cell> - <End cell> is stored.
Example:
In the above vision program, when "J95" and "Q98" are specified in the <Start cell> and <End cell> of the
NVPST command or NVIN command, the value of C_NVS1() becomes the following values.
Element 2
Element 1
1 2 3 4 5 6 7 8 9
1 “X” “Y” “C” “Score”
“”
“X” “Y” “C” “Score”
2 “347.147
”
“-20.232”
“-158.19
8”
“97.641”
“”
“110.141
”
“120.141
”
“72.645” “97.641”
3 “381.289
”
“49.017” “10.844”
“97.227”
“”
“89.585”
“99.585”
“-118.31
3”
“97.227”
4
“310.81” “43.649” “-34.313”
“96.217”
“”
“139.151
”
“149.151
”
“-163.47” “96.217”
C_
NVS1
()
5
“” “” “” “” “” “” “” “” “”
[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]
10 DIM MSCORE(100) 'Declares the variable for storing scores.
100 IF M_NVOPEN(1)<>1 THEN
' When logon has not been completed for vision sensor number 1
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”,”J95”,”Q98”,3,10
'Starts the "Test" program, receives the recognition count from the E76 cell and the recognition results from
cells J95 through Q98, and stores this in C_NVS1(1,1) - and M_NVS1(1,1) - .
150 MVCNT=M_NVNUM(1)
'Acquires the number of pieces of work recognized by the vision sensor.
160 FOR MCNT2=1 TO 8
170 IF C_NVS1(1,MCNT2)=”Score” THEN BREAK
180 NEXT MCNT2
300 FOR MCNT1=1 TO MVCNT
'Repeated once for each piece of work recognized
310 MSCORE(MCNT1)=VAL(C_NVS1(MCNT1+1,MCNT2)) ' Stores the score for the recognized work into
MSCORE
320 NEXT MCNT1
330 MOK=0
' Clears MOK
330 FOR MCNT=1 TO MVCNT
'Repeated once for each piece of work recognized
340 IF MSCORE(MCNT)>90 THEN MOK=MOK+1 'If the score is 90 points or higher, adds 1 to MOK.
350 NEXT MCNT
360 ' Checks the value of MOK and checks the number of pieces of work for which the score is 90 points or
higher.