12.07.2015 Views

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

442 Program Control <strong>Instructions</strong> (JMP, LBL, JSR, RET, SBR, JXR, TND, MCR, UID, UIE, AFI, NOP, EOT, SFP, SFR, EVENT)To program a jump to a subroutine, follow these guidelines:IMPORTANTDo not use a JSR instruction to call (execute) the main routine.• You can put a JSR instruction in the main routineor any other routine.• If you use a JSR instruction to call the mainroutine and then put a RET instruction in themain routine, a major fault occurs (type 4,code 31).The following diagram illustrates how the instructions operate.Calling RoutineSubroutineSBRJSR1. If you want to copy data to a tag inthe subroutine, enter an inputparameter.JSRSBRRET1. If the JSR instruction has an inputparameter, enter an SBR instruction.2. Place the SBR instruction as the firstinstruction in the routine.3. For each input parameter in the JSRinstruction, enter the tag into which2. If you want to copy a result of thesubroutine to a tag in this routine,enter a return parameter.RET429743. Enter as many input and returnparameters as you need.RET1. If the JSR instruction has a return parameter, enter an RETinstruction.2. Place the RET instruction as the last instruction in the routine.3. For each return parameter in the JSR instruction, enter a returnparameter to send to the JSR instruction.4. In a ladder routine, place additional RET instructions to exit thesubroutine based on different input conditions, if required.Publication 1756-RM003I-EN-P - January 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!