Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

Chapter 12 For/Break Instructions (FOR, FOR...DO, BRK, EXIT, RET)

Return (RET)

The RET instruction returns to the calling FOR instruction.

Operands:

Relay Ladder

none

Description:

IMPORTANT

Do not place a RET instruction in the main routine. If you place a RET instruction in the main routine, a major fault occurs (type

4, code 31).

postscan

When enabled, the RET instruction returns to the FOR instruction. The FOR instruction increments the Index value by the Step size and executes the subroutine again. If the Index value exceeds the Terminal value, the FOR instruction completes and execution moves on to the instruction that follows the FOR instruction.

The FOR instruction does not use parameters. The FOR instruction ignores any parameters you enter in a RET instruction.

You could also use a TND instruction to end execution of a subroutine.

Arithmetic Status Flags:

not affected

Fault Conditions:

A Major Fault Will Occur If

main routine contains a RET instruction

Fault Type

4

Fault Code

31

Execution:

Condition:

prescan rung-condition-in is false rung-condition-in is true

Relay Ladder Action

The rung-condition-out is set to false.

The rung-condition-out is set to false.

Returns the specified parameters to the calling routine.

The rung-condition-out is set to true.

The rung-condition-out is set to false.

474

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

For/Break Instructions (FOR, FOR...DO, BRK, EXIT, RET) Chapter 12

Example:

The FOR instruction repeatedly executes routine_2 and increments value_2 by 1 each time. When value_2 is

>

10 or a BRK instruction is enabled, the FOR instruction no longer executes routine_2.

The RET instruction returns to the calling FOR instruction. The FOR instruction either executes the subroutine again and increments the Index value by the Step size or, if the Index value exceeds the Terminal value, the

FOR instruction is complete and execution moves on to the instruction that follows the FOR instruction.

calling routine subroutine

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

475

Chapter 12 For/Break Instructions (FOR, FOR...DO, BRK, EXIT, RET)

Notes:

476

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

advertisement

Related manuals

advertisement

Table of contents