PLC Programming how to write clean code

PLC programming JMP and LBL code

Seldomly in plc programming you want to manipulate how the plc scanner runs. You may want to allow it to move to different goto points of the ladder diagram. For this we make use of JMP and LBL. LBL allows us to tag a certain rung on the left and hand side and JMP allows us to specify a label which we want to jump to. This is very similar to how it works in assembly language. It is important to note that any rung which has a label and does not contain some type of jmp instruction somewhere may never be executed. So these rungs usually will be completely ignored. It’s always good practice to try and avoid this scenario as jmp and lbl can make your ladder program really messy and hard to debug if things are jumping around all the time.

Below is an example of how JMP and lBL works.

Example of JMP and LBL

img_58b022f55c0aa.png

plc programming jmp and lbl

Word of warning when using JMP and LBL instructions

Remember that having this sort of command can make it nice and easy to manipulated the jumps. However the difficulty can quickly outweigh the advantages when using this instruction too much in your plc programs. Try and keep jmp and lbl to a minimum when implementing in your programs. It will just make things and dodge lots and lots annoyances which you may encounter later on. It is better to organize your programs in a logical way where it is easy to view and easy to understand for any future projects which you may encounter. However jmp and lbl can be quite nicely utilized in smaller applications, but word of caution to the less wise.

Citations :


plc programming
plc supplier
automation companies in south africa

Comments