Download Local PDF

Transcript
Program Control Instructions (JMP, LBL, JSR, RET, SBR, JXR, TND, MCR, UID, UIE, AFI, NOP, EOT, SFP, SFR, EVENT)
443
There are no restrictions, other than controller memory, on the
number of nested routines you can have or the number of parameters
you pass or return.
level 1
level 2
level 3
SBR
SBR
SBR
main routine
action_1
JSR
action_2
JSR
action_3
JSR
RET
RET
RET
Arithmetic Status Flags: Arithmetic status flags are affected.
Fault Conditions:
A Major Fault Will Occur If
Fault Type
Fault Code
JSR instruction has fewer input parameters than SBR instruction
4
31
JSR instruction jumps to a fault routine
4 or user-supplied
0 or user-supplied
RET instruction has fewer return parameters than JSR instruction
4
31
main routine contains a RET instruction
4
31
Execution:
Relay Ladder and Structured Text
Condition
Relay Ladder Action
Structured Text Action
prescan
The controller executes all subroutines regardless of rung condition. To ensure that all rungs in the
subroutine are prescanned, the controller ignores RET instructions. (that is, RET instructions do not exit
the subroutine.)
• Release 6.x and earlier, input and return parameters are passed.
• Release 7.x and later, input and return parameters are not passed.
If recursive calls exist to the same subroutine, the subroutine is prescanned only the first time. If multiple
calls exist (non-recursive) to the same subroutine, the subroutine is prescanned each time.
The rung-condition-out is set to false (relay ladder only).
rung-condition-in is false to The subroutine does not execute.
the JSR instruction
Outputs in the subroutine remain in their last state.
na
The rung-condition-out is set to false.
Publication 1756-RM003I-EN-P - January 2007