Repeat Control With Specified Count: For - Next - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Repeat control with specified count: FOR - NEXT

Format
FOR(D) = (S1)TO(S2)STEP(S3) -
NEXT
Setting data
■Usable Data
: Usable
Setting
Usable Data
data
Bit
device
(D)
(S1)
(S2)
(S3)
■Description, data type of result
Setting data
Description
(D)
Device used for loop control counter
(S1)
Initial value of loop control counter
(S2)
Final value of loop control counter
(S3)
Incremental value of loop control counter
Processing details
• (S1) is substituted to the device specified with (D) as initial value, and the block between FOR and NEXT is repeatedly
executed.
• The incremental value specified with (S3) is added to the device specified with (D) at every execution of NEXT. If the device
value specified with (D) is larger than the final value specified with (S2), the repeat control of the block between FOR and
NEXT is ended, and the next block of NEXT is executed.
• When the incremental value specified with (S3) is negative number, if the device value specified with (D) is smaller than the
final value specified with (S2), the repeat control of the block between FOR and NEXT is ended.
• STEP can be omitted. If STEP is omitted, the repeat control is executed as "STEP 1".
• Maximum multiplicities of repeat control are eight.
FOR...
FOR...
NEXT
NEXT
• When data types of (D), (S1), (S2) and (S3) are different, type conversion processing is executed but an unintended
operation may occur. Set the same data type.
Operation error
In the following case, an operation error will occur, and the corresponding Motion SFC program No. execution will be stopped.
For the subroutine called program, the call source program also stops to execute.
• (S1) data is outside the range of (D) data type.
• (D), (S1), and (S2) are indirectly specified devices, and the device No. is outside the range.
• FOR to NEXT instruction is executed over the limited count for repeat control set in parameter in an operation control
program or a transition program.
4 OPERATION CONTROL PROGRAMS
198
4.14 Program Control
Number of basic steps
FOR: 18
NEXT: 15
Word device
16-bit
32-bit
64-bit
integer
integer
floating
type
type (L)
point
type (F)
(2 level) (1 level)
Usable steps
F/FS
Constant
16-bit
32-bit
64-bit
integer
integer
floating
type
type
point
(K/H)
(K/H, L)
type (K)
G
Calculation
Bit
expression
conditional
expression
Data type of result
Comparison
conditional
expression

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents