EasyManua.ls Logo

FATEK FBs-CB2 - FOR (FUN 70 FOR)

FATEK FBs-CB2
348 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Advanced Function Instruction
7-53
FUN 70
FOR
FOR
FUN 70
FOR
FOR
Ladder symbol
70.
N
N : Number of times of loop execution
WX WY WM WS TMR CTR HR IR OR SR ROR DR K
Range
Ope-
rand
WX0
WX240
WY0
WY240
WM0
WM1896
WS0
WS984
T0
T255
C0
C255
R0
R3839
R3840
R3903
R3904
R3967
R3968
R4167
R5000
R8071
D0
D4095
1
16383
N
z This instruction has no input control, is connected directly to the power line, and cannot be in series with
any conditions.
z The programs within the FOR and NEXT instructions form a program loop (the start of the loop program is
the next instruction after FOR, and the last is the instruction before NEXT). When PLC executes the FOR
instruction, it first records the N value after that instruction (loop execution number), then for N times
successively execution from start to last of the programs in the loop. Then it jumps out of the loop, and
continues executes the instruction immediately after the NEXT instruction.
z The loop can have a nested structure, i.e. the loop includes other loops, like an onion. 1 loop is called a
level, and there can be a maximum of 5 levels. The FOR and NEXT instructions must be used in pairs. The
first FOR instruction and the last NEXT instruction are the outermost (first) level of a nested loop. The
second FOR instruction and the second last NEXT instruction are the second level, the last FOR instruction
and the first NEXT instruction form the loop's innermost level.
71
NEXT
FOR 4
FOR 3
70
FOR
2
NEXT
NEXT
70
70
71
71
2
3
1
˙In the example in the diagram at left, loop
c will be
executed 4 ×3 ×2 = 24 times, loop
d will be
executed 3 ×2 = 6 times, and loop
e will be
executed 2 times.
˙If there is a FOR instruction and no corresponding NEXT
instruction, or the FOR and NEXT instructions in the
nested loop have not been used in pairs, or the sequence
of FOR and NEXT has been misplaced, then a syntax
error will be generated and this program may not be
executed.
˙In the loop, the JMP instruction may be used to jump out
of the loop. However, care must be taken that once the
loop has been entered (and executed to the FOR
instruction), no matter how the program flow jumps, it
must be able to reach the NEXT instruction before
reaching the END instruction or the bottom of the
program. Otherwise FBs-PLC will halt the operation and
show an error message.
˙The effective range of N is 1~16383 times. Beyond this
range FBs-PLC will treat it as 1. Care should be taken , if
the amount of N is too large and the loop program is too
big, a WDT may occur.

Other manuals for FATEK FBs-CB2

Related product manuals