Program control (output instruction)

LBL: Label

The target a JMP jumps to.

Also called: jump label, jump target, pointer.

LBL(label)

What it does

LBL does nothing except mark a place in the program. It takes no conditions, it is always reached when the scan gets to it in the ordinary way, and its only purpose is to give a JMP somewhere to land.

It has to be in the same routine as the JMP that names it. Jumping between routines is what JSR is for.

A label can sit above the JMP that targets it, which turns the pair into a loop. That is occasionally useful and mostly a trap: a controller has a watchdog that faults if a scan takes too long, and this simulator caps how many rungs one routine may execute for the same reason.

The thing to understand about jumping is what happens to what you jumped over. Those rungs are not scanned, so their outputs hold their last state. Jumping past a coil does not turn it off; it takes away the only thing that could.

A rung you can run

One lamp obeys, one lamp is stuck

RUNG 1Hold_OutputsJMPResumeRUNG 2Lamp_CmdHeld_LampRUNG 3LBLResumeRUNG 4Lamp_CmdFree_Lamp
XIC(Hold_Outputs)JMP(Resume)
XIC(Lamp_Cmd)OTE(Held_Lamp)
LBL(Resume)
XIC(Lamp_Cmd)OTE(Free_Lamp)

Turn Lamp_Cmd on and both lamps light, because nothing is being skipped. Now turn Hold_Outputs on and turn Lamp_Cmd off again: Free_Lamp goes out and Held_Lamp stays on, with no rung anywhere asking it to. Its rung was jumped over, so the OTE that would have turned it off never ran.

Run this rung in the simulator

What it is called on other controllers

PlatformEquivalent
Rockwell (Studio 5000)LBL
Siemens (TIA Portal)LABEL, the target of a JMP
Mitsubishi (GX Works)A pointer, written P0, P1 and so on
CODESYS and IEC 61131-3A label on a network or a statement

Common mistakes

  • Expecting jumped-over outputs to drop out. They freeze. This catches nearly everybody once, and the example below is worth running for it alone.
  • Using the same label name twice in one routine. The jump lands on the first one, and the second is never reached by any jump at all, which reads as though the code between them is dead.

Practise it

Interactive exercises that use LBL. Each one checks your ladder against a real scan.

Related instructions

All ladder logic instructions