Repeat the measurements

Overview

It repeats until the specified processing unit satisfies it.

Specification of this example


Behavior
Repeat the measurements([Camera Image Input] -> [Search]) ten times and count the number of OK.
Output the number of OK via the serial interface.
And then, set the number of OK to 0.

How to try this example
1.Click the link below, then the folder containing zip file automatically opens.
refFile

2.Right-click and hold on the zip file, and drop it on working window of FJ system. The images and scene data in zip file are loaded on the program automatically.

3.Re-measure the image. Then System automatically repeats the measurements ten times, and outputs the number of OK via the serial interface.

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Search
2.
Macro
The Macro Program below segment is to be set in '2.Macro'.
Macro Program
*MEASUREPROC
    MYUNIT& = UnitNo

    For LP& = 0 To 8                              '(1)
        RECGJDG& = UnitData(MYUNIT& - 1, "JG")
        If RECGJDG& = JUDGE_OK Then
            OK& = OK& + 1
        EndIf

        MeasureProc 0                             '(2)
        MeasureProc 1
    Next

    SendString "SerialNormal" Str$(OK&)           '(3)

    OK& = 0                                       '(4)
Return

The macro program is in refthis link.
Explanation
(1)Repeat nine times, count the number of OK.
(2)Run [Camera Image Input] -> [Search].
(3)Output the number of OK via the serial interface.
(4)Set the number of OK to 0.