460 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 11 Program Control Instructions (JMP, LBL, JSR, RET, SBR, JXR, TND, MCR, UID, UIE, AFI, NOP, EOT, SFP, SFR, EVENT)
Example 2:
Relay Ladder
MainRoutine
When abc is on, subroutine_1 executes, calculates the number of cookies, and places a value in cookies_1.
Adds the value in cookies_1 to cookies_2 and stores the result in total_cookies.
Subroutine_1
When def is on, the RET instruction returns value_1 to the JSR cookies_1 parameter and the rest of the subroutine is not scanned.
When def is off (previous rung) and ghi is on, the RET instruction returns value_2 to the JSR cookies_1 parameter and the rest of the subroutine
is not scanned.
When both def and ghi are off (previous rungs), the RET instruction returns value_3 to the JSR cookies_1 parameter.