Goto command, If command – Rockwell Automation 1775-KA PLC-3 Communication Adapter Module User Manual User Manual

Page 85

Advertising
background image

Message Procedure Commands

Chapter 6

6Ć7

The format of the EXIT command is simply the single letter

E

Without any modifiers or parameters.

Each main procedure and nested procedure must end with either an EXIT
command or a STOP command. The EXIT command is the preferred
means of ending a procedure because the STOP command results in error
179 (Appendix B).

The commands in a message procedure are normally executed
sequentially. The GOTO command can change the order of execution.

Table 6.A illustrates the format of the GOTO command. Note that the
parameter for a GOTO command is a label. Labels are signposts, or tags,
that mark a location within the message procedure.

To generate a label, simply enter it on any one of the lines in a message
procedure. The format for the label is

LABEL _A:

Nothing else may appear on the same line with the label. The label itself
must conform to the same rules of construction as user symbols do. The
trailing colon (:) is required when you first generate the label, but do not
use the colon any other time you refer to the label.

When a GOTO command is encountered, execution of the message
procedure resumes with the first command after the label specified in the
GOTO. Note that you cannot use the GOTO command to jump from one
procedure to another, even if the procedures are nested.

The IF command makes logic decisions in the message procedure. Table
6.A shows the format of the IF command. The first parameter of the IF
command is an expression (Chapter 4). The entire expression must be
enclosed in a set of parentheses. The expression may be made as complex
as desired through the use of multiple operators and nested expression.

The second element in the IF command is an embedded command. If the
value of the expression is true (1), the embedded command is executed. If

GOTO Command

IF Command

Advertising