PLC Programming why to write clean code
PLC programming JMP and LBL instructions
Seldomly in plc programming you want to change how the plc rungs runs. You may want to allow it to move to different labels of the ladder rugs. For this we make use of JMP and LBL. LBL allows us to name 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 eg of how JMP and lBL works.
Example of JMP and LBL
Word of caution when using JMP and LBL instructions
Remember that having this sort of instruction can make it clean and easy to manipulated the jumps. However the complexity can quickly outweigh the benefits when using this instruction too much in your plc programs. Do your best and keep jmp and lbl to a minimum when using in your programs. It will just simplify things and avoid lots and lots frustration which you may encounter later on. It is better to organize your programs in a logical way where it is easy to read and easy to understand for any future projects which you may encounter. However jmp and lbl can be quite nicely utilized in tiny programs, but word of caution to the less wise.
More info :
plc programming
plc supplier
industrial automation
Comments
Post a Comment