![FATEK FBs Series Скачать руководство пользователя страница 217](http://html1.mh-extra.com/html/fatek/fbs-series/fbs-series_manual_3764826217.webp)
Advanced Function Instruction
7 -5 3
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.
Содержание FBs Series
Страница 78: ...MEMO ...
Страница 111: ...4 6 X0 X1 Node A Y0 Y1 Node B differential down Incerse differential up t Scan time Inverse t t ...
Страница 141: ...Basic Function Instruction 6 16 FUN 2 SKP SKIP START FUN 2 SKP Y2 Y1 Y0 T201 10S X0 X1 X2 0 10 0 ...
Страница 305: ...MEMO ...
Страница 348: ...MEMO ...