Allen-Bradley Logix5000 Reference Manual page 456

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Chapter 11
Program Control Instructions (JMP, LBL, JSR, RET, SBR, JXR, TND, MCR, UID, UIE, AFI, NOP, EOT, SFP, SFR, EVENT)
JSR
1.If you want to copy data to a tag in the
subroutine, enter an input parameter.
2.If you wan t to co py a re sult of the
subroutine to a tag in t his routine, enter a
return parameter.
3.Enter as man y in put an d return
parameters as you need.
456
Use these guidelines to program a jump to a subroutine.
IMPORTANT
The following diagram illustrates how the instructions operate.
Calling Routine
JSR
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Do not use a JSR instruction to call (execute) the main routine.
· You can put a JSR instruction in the main routine or any
other routine.
· If you use a JSR instruction to call the main routine and
then put a RET instruction in the main routine, a major fault
occurs (type 4, code 31).
Subroutine
1.If th e J SR in struction ha s an input
parameter, enter an SBR instruction.
SBR
2.Place the SBR instruct ion as the first
instruction in the routine.
RET
3.For each in put p arameter in th e JSR
instruction, enter the tag into which you
want to copy the data.
RET
42974
RET
1.If the JSR instruction has a return parameter, enter an
RET instruction.
2.Place th e RET ins truction as th e la st in struction in t he
routine.
3.For each return parameter in the JSR instruction, enter a
return parameter to send to the JSR instruction.
4.In a ladder routine, place ad ditional RET instructions to
exit the subroutine based on different input conditions, if
required. (Fu nction block rou tines only pe rmit one RET
instruction.)
SBR

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents