FOR n (s)

Chapter 5 Instruction Specifications

Item number

 

Control instructions-6

 

 

Name

 

FOR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder format

 

 

 

 

 

 

Condition code

 

 

 

 

Processing time (s)

Remark

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R7F4

 

R7F3

 

R7F2

R7F1

 

R7F0

Average

Maximum

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FOR n (s)

 

 

DER

 

ERR

 

SD

 

V

 

 

 

C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

z

1]

 

 

z

 

z

 

 

 

z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction format

 

 

 

 

 

 

Number of steps

 

 

 

 

33

 

 

 

 

 

 

 

 

 

 

 

Condition

 

 

 

Steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FOR n (s)

 

 

 

 

 

 

 

 

 

 

 

 

 

3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

Word

 

Double word

 

Constant

 

 

 

Usable I/O

 

 

X

Y

M

 

 

CU, CT

 

WX

WY

WM

 

TC

DX

DY

DM

 

 

Other

 

 

 

 

 

 

 

 

R,

 

 

TD, SS,

 

 

 

 

WR,

 

 

 

 

DR,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

n

Code number

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

{

 

0 to 49 (Decimal)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

s

Number of times repeated

 

 

 

 

 

 

 

 

 

 

{

 

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Function

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

• Jumps from the NEXT n of the same code number to this instruction.

• If the number of times repeated (s) is greater than 0, the instruction following the FOR n (s) is executed.

• If the number of times repeated (s) is equal to 0, it jumps to the instruction following the NEXT n.

• Use FOR n (s) and NEXT n in pairs. Also, place the NEXT n after FOR n.

• The FOR n (s) may not be used more than once.

• Use the FOR n (s) and NEXT n in the same program area. (It is not allowed to include FOR n (s) in the normal scan and NEXT n in the subroutine area.)

• The FOR n (s) to NEXT n nesting can be made up to five levels.

Notes

• This instruction is checked prior to execution, and when there is an error, the following error code is set in the special internal output WRF001. Also, the CPU error code '34' is set to special internal output WRF000.

CPU error code

Special internal output

Error code

Error description

 

 

 

 

34

WRF001

H0001

Duplicate definition of FOR

 

 

 

 

• If an error is generated during the execution of the instruction, an error code will be set in the special internal outputs R7F3 and WRF015, and the following program will be executed.

Special internal output

Error code

Error description

 

 

 

 

 

 

H0017

NEXT undefined

 

 

 

 

 

 

H0043

FOR to NEXT error

 

 

 

 

R7F3=1

WRF015

H0044

Area error for NEXT

 

 

 

 

 

 

H0045

FOR to NEXT nesting error

 

 

 

 

 

 

H0046

FOR nesting overflow

 

 

 

 

Instruction for use

For the instruction instruction, see NEXT n.

5-106

Page 156
Image 156
Hitachi NJI-350B manual Control instructions-6, Code number To 49 Decimal, For the instruction instruction, see Next n, 106