Introduction to PLC, Fatek PLC Introduction, Getting Started With PLC, Getting Started With Fatek PLC
Hello everyone, I hope you all are doing great. In today's tutorial, I am going to share the detailed fIn the previous post, we have seen Introduction to PLC, which was quite simple and has the basic introduction to PLC. To day we are gonna have a look at Getting Started With Ladder Logic For PLC. Ladder Logic, also named as Ladder Logic Programming, is the programming language for PLCs. Its normally considered as the most difficult language among the engineers because of its complex structure, but if you ask me then I will say its the most interesting programming language.

Ladder Logic is different from the usual programming language of Microcontrollers like Arduino, PIC Microcontroller etc. Microcontrollers programming usually compiled from top to bottom i.e. the compiler first capture the first statement and then moves downward till it reaches the end line but that's not the case with Ladder Logic Programming for PLC. In ladder logic, the compiler moves from left to right and it gets all the lines at the same time. It seems bit difficult to understand at first but be with me and you will get it at the end. :)

Introduction to Ladder Logic

Ladder Logic is a programming language used for PLC as C for Microcontrollers. Ladder logic is a combination of rungs. Each rung is executed from left to right. For example, have a look at the below figure, a single rung of ladder logic is shown in it.

Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc

  • In the above figure, a single rung of ladder logic is shown. Now as I mentioned earlier, each rung is executed from left to right, so the above rung will also do the same behavior.
  • There are two symbols mentioned in the above rung, one is X0 and the other is Y0. X0 is placed on the left side while Y0 is placed on the right side.
  • We have seen in our previous tutorial Introduction to PLC, that X always indicates input and Y indicate output, so in short the above rung has input on the left side while output on the right side.
  • So combining all the above discussion, we come to the conclusion that input will be executed first and then output will be executed, as shown below. (I hope you got the basic theory now :) )
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc
  • So now the thing is, if we only consider the above rung, the output Y0 will be ON only if input X0 will be ON. If X0 is OFF then Y0 will also be OFF. Consider this rung as a voltage wire as shown in below figure:
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc
  • So, now the output will be ON only when it has HIGH and LOW but input is acting as a switch and in normal condition, its OFF so HIGH is not reaching to output so it will remain OFF, as we turn ON the input X0, it will be like the switch is closed and HIGH will pass through the X0 and will reach Y0 and Y0 will turn ON. I tried my best to explain it as simple as I can but still having confusion, ask in comments.
  • Now let's have a look on different logical gates i.e. AND gate, OR gate, NAND gate etc, we normally create in ladder logic.

1. Logical AND in Ladder Logic for PLC

  • We all know about the Logical AND gate, in AND gate we get output only if both the inputs are HIGH, otherwise OUTPUT remain OFF.
  • The below figure shows the same logical AND gate designed in Ladder Logic diagram:
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc
  • Now in the above figure Y0 will be ON when both X0 and X1 are ON, otherwise Y0 will be ON, again consider inputs as switches.
  • Its a simple 2 input AND logic, we can add as many inputs as we want in it. For example, below image shows a four input AND gate.
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc

2. Logical OR in Ladder Logic for PLC

  • In Logical OR gate, output goes ON when any of the inputs is ON, lets implement it in our ladder logic form.
  • The below figure shows the ladder logic form for OR gate:
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc
  • If you check the above figure, if X1 goes ON then our connection will connect and Y0 will be ON, similarly, if X0 is OFF and X1 is ON then again Y0 will be ON because now voltage is coming from X1. Again consider inputs as switch.

3. Logical NOT in Ladder Logic for PLC

  • In logical NOT gate, output is always opposite to input, if input is HIGH then output will be LOW and vice versa.
  • In order to implement NOT gate, we have to consider another type of input, the input which we are using till now is normally open input, means it is open (OFF) in its normal condition and gets closed (ON) when input is supplied, but in ladder logic there's another type of input also present named as normally closed input.
  • Normally closed input is closed (ON) in its normal condition and goes open (OFF) when it gets actual input.
  • So, using this normally closed input, we can quite easily implement this Logical NOT gate in ladder logic as shown in below figure:
Getting Started With Ladder Logic,basics of PLC programming, introduction to plc programming, ladder logic for plc
  • In the above figure X0 will be ON in normal condition and hence, Y0 will also be ON and when we get actual input then X0 will get OFF and our Y0 will also be OFF.
So, that was all for today. As you have got the basic knowledge of Ladder Logic, so now its time to have a look at How to design Logical Gates in Ladder Logics for PLC. Thanks for reading. :)