Mitsubishi — 3.14.3.6 Flow Control

Chapter 3 Creating and Editing Screens Example CALL Main Macro Sub-Macro A1 The rights of macro control will be transferred to sub-macro when executing CALL RET Var1 command. After CALL Var1 command is executed and completed, Var1 needs to return through RET command. RET command will transfer the rights of macro control to the next command of CALL command. The sub-macro number could be 1 ~ 512. Regarding the comment name of the sub-macro, the user can name it freely. In the sub-macro program, the users also can CALL another sub-macro but the levels for CALL submacro should be less than 6 levels due to memory limit and also for avoiding unexpected error.

 FOR…NEXT (Program Loop) Equation FOR Var1 Statement NEXT Explanation It is for nested loops. ”FOR” is the start of the loop and “NEXT” is the end of the loop. When this command is executed, the number of Var1 Statement will be executed continuously. The users can change the Var1 value through command, but the number of times cannot be changed. Remark  The nested loop can be up to 3 levels max.  Var1 can be internal memory or constant.  Statement is the combination of a section of macro commands and also can be within the nested loop. Example If $10=10, $0=0, after the operation, the result is $0 = 10 If a $10 = 2 is inserted between the FOR and the NEXT in the above macro, the FOR …

NEXT loop will still loop 10 times even though $10 is changed to a value of 2 the first pass through the loop. 3-350 Revision May, 2010