Jump / label, Program structure instruction summary, Jump / label program structure instruction summary – Rockwell Automation 1398-PDM-xxx IQ Master Version 3.2.4 for IA-2000 and IQ-5000 Positioning Drive Modules, IQ-55 User Manual

Page 168: Tutorial

Advertising
background image

146

IQ Programming Structure • Program Structure Instructions

Publication 1398-PM601A-EN-P — October 2000

TUTORIAL

The following flowchart and code segment illustrate the use of the ON instruction.

JUMP / Label

The JUMP instruction can be used to transfer program execution to a new point marked by a label. This
instruction is often used as the action of an IF statement. The destination label may be above or below
the JUMP statement in the application program.

Labels may be any alphanumeric string up to 32 characters in length beginning with a letter and fol-
lowed by a colon “:”.

JUMP TestInputs

…statements

TestInputs:

…statements

IF (I1 = ON) JUMP TestInputs

Refer to Part 5

Language Reference for more detailed information.

Program Structure Instruction Summary

The following table contains a summary of instructions that relate to program branching. Refer to Part 5

Language Reference for more detailed information.

statements

BCD V1 = I12, 2

ON V1 JUMP MOVE0, MOVE1, MOVE2, MOVE3

BAD_V1:;number < 0 or > 3

PRINT 1,1 “Not a valid Num.”

JUMP ENDSELECT

MOVE0:

MOVD = 1

JUMP ENDSELECT

MOVE1:

MOVD = 3

JUMP ENDSELECT

MOVE2:

MOVD = 7

JUMP ENDSELECT

MOVE3:

MOVD = 9

ENDSELECT:

statements

Name

Description

CALL

Call a subroutine

DO/WHILE

Do once and keep doing while a condition is true

IF & IF/ELSE

Execute if a condition is true

Start

Read BCD into V1

End

Not a valid

Number ?

V1 = 0?

V1 = 1?

V1 = 2?

Move distance 9 inches

Move distance 7 inches

Move distance 3 inches

Move distance 1 inch

Print "Not a valid number"

Advertising