Skip to main content

Loop End (NEXT)

Instruction Parameters

Supported PLC Series

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S

Supported Data Registers

MXYKLFTCSZRQD@DConstant
---------------

Supported Flags

FlagBitSupport
ErrorF11.0-
ZeroF11.1-
CarryF11.2-

Number of Steps

Steps
1

Notice

Instruction Behavior

The NEXT instruction behaves as follows:

  • Instructions within the bounds of the FOR ~ NEXT instruction are executed n times.
    • When the loop ends, the instruction after the NEXT instruction is executed.
  • Nesting FOR ~ NEXT instructions is possible up to 16 nests.
  • The FOR ~ NEXT instructions must be used in pairs.
Excessive Use

If the FOR ~ NEXT instructions are used excessively, the scan time increases.
The system might be overloaded causing the CPU to shut down or initialize.

Examples