WWW.NNC.IR
Basic Knowledge For Macro Customize
Functions
243
5
Optimizing Scenes (Measurement Flows) (Macro Customize
Functions)
Vision System FH/FZ5 Series
User’s Manual (Z340)
Stopping the Program When a Specific Condition is Met
The program can also be stopped when a specific condition is met. Setting an appropriate condition allows
the location of an error to be identified more efficiently than with the Stop function.
*MCRINIT
Debug 18
Rem Use the SetStop function to set the program stop condition so that the program stops when the Stop function
parameter is 0
SetStop Str$(0)
Return
*MEASUERPROC
Rem The actual measurement process is written from here
POS.X#=(POS0.X@ + POS1.X@) / 2
POS.Y#=(POS0.Y@ + POS1.Y@) / 2
Rem Execute the Stop function and stop the program on the line where the POS.X# variable is 0
Stop Str$(POS.X#)
Rem Execute the Stop function and stop the program on the line where the POS.Y# variable is 0
Stop Str$(POS.Y#)
Print POS.Y# / POS.X#
Return
A true/false relational expression (true: -1, false: 0) can also be set as the condition for the Stop function.
Example: Stopping the program when the CORRELATION& variable is less than 60
Set the SetStop function so that the program stops when the relational expression is true (-1).
SetStop Str$(-1)
The Stop function stops the program when the relational expression CORRELATION& < 60 is true.
Stop Str$(CORRELATION& < 60)