6F3B0253

7. Instructions

FUN 132

FOR

FOR (FOR-NEXT loop)

Expression

Input [ FOR n ]Output

Function

When the input is ON, the program segment between FOR and NEXT is executed n times repeatedly in a scan.

When the input is OFF, the repetition is not performed. (the segment is executed once)

Execution condition

Input

 

Operation

Output

OFF

No repetition

 

OFF

ON

Repetition

 

ON

Operand

 

Name

 

 

Device

 

 

 

 

 

Register

 

 

 

 

 

Constant

Index

 

 

X

Y

R

S

T.

C.

XW

YW

RW

SW

T

C

D

I

 

J

K

 

 

n

Repetition

 

 

 

 

 

 

√ √

 

 

1 - 32767

 

 

times

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This segment is executed 30 times repeatedly in a scan.

When R005 is ON, the program segment between FOR and NEXT is executed 30 times in a scan.

R005

[ FOR 30 ]

[ NEXT ]

Executed 30 times in a scan when R005 is ON.

Basic Hardware and Function 205

Page 207
Image 207
Toshiba 6F3B0253 user manual For FOR-NEXT loop