beautypg.com

Sample program, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 333

background image

2-297

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

Subr

out

ines I

n

stru

ctio

ns

2

SBN/RET

The step instructions, STEP(008) and SNXT(009) cannot be used in subroutines.

Place the subroutines after the main program and just before the END(001) instruction in the program

for each task. If part of the main program is placed after the subroutine region, that program section
will be ignored.

Sample program

Note The input method for the subroutine number, N, is dif-

ferent for the CX-Programmer. Input #0 to #127 on
the CX-Programmer.

When CIO 0.00 is ON in the following exam-
ple, subroutine 10 is executed and program
execution returns to the next instruction after
the SBS(091) or MCRO(099) instruction that
called the subroutine.

SBN

SNXT

STEP

RET

Not allowed

END

Subroutine region

This part of the
program won’t
be executed.

SBS

n

0.00

SBN

n

RET

SBS

#10

0.00

SBN

#10

RET

END

Subroutine 10

This manual is related to the following products: