FOR Ladder Logic Instruction

Use the For instruction to scan a Ladder routine repeatedly. The For instruction is handy for populating elements in arrays as an example. The instruction will repeatedly scan a routine until the Index Value exceeds the Terminal Value.

List of possible arguments

  • Routine Name             ROUTINE                             Routine to call
  • Index                              DINT                                      Routine run count
  • Initial Value                 SINT or INT                        Starting value
  • Terminal Value           SINT, INT, OR DINT        Stop value
  • Step Size                       SINT, INT, OR DINT       Value to add every index

Note: Don’t call the main routine with the FOR instruction, why would you do that anyway? It’s possible to end the FOR instruction early with a BRK instruction. Running the FOR instruction too long could cause a Watchdog Fault, so watch your scan time.

Leave a Comment