Ladder Logic Programming Instructions – Part 2

Ladder Logic Programming Instructions – Part 2

Welcome to the second part of my ladder logic tutorial. In part 1 of the Ladder Logic tutorial, I introduced you to the very basics of ladder logic and to some basic instructions.

In this second part of the tutorial I will teach you how to solve actual problems with ladder logic and how to use it to build PLC programs. At the same time you will be introduced to several other ladder logic instructions:

Set / Reset Coils

The Set/Reset pattern, also known as the Latch/Unlatch pattern or simply “Latch Bit” is for remembering some on/off state of the machine that has to survive a power outage:
Set and Reset Functions: Set (S): This instruction forces a specific output bit (memory bit) to be ON (1). This is typically used to activate an output or to store a certain condition.
Reset (R): This instruction forces a specific output bit (memory bit) to be OFF (0). It is used to deactivate an output or reset a stored condition.

Ladder Logic

Thereby you can set an output in one place in your ladder logic. You can then reset the coil in a totally different place in your ladder logic.

How to work:


Ladder Logic

  • I0.0 (Start Button): When this input is ON, it will set the output Q0.0 to ON.
  • I0.1 (Stop Button): When this input is ON, it will reset the output Q0.0 to OFF.
  • Q0.0 (Output): This output bit will be latched (set to ON) when the start button is pressed and will remain ON until the stop button is pressed, which resets it.
  • Uses: Set: To store a state or condition that should remain active even after the triggering condition goes away (latched state).
  • Reset: To return to a neutral state or reset a condition after the Set function has been activated.

One Shots for Signal Edges

Normally you would expect the operator to press the start and stop buttons only once – and for a short time. But the operator can hold the buttons pressed for longer time or the button can simply be stuck when pressed

If the stop button for one of the motors somehow gets stuck, you will not be able to start the motor. In fact, this is a problem often encountered when you have momentary push buttons as inputs on the PLC.

But don’t worry. There is a solution to this problem. Luckily for us there are ladder logic instructions that can solve this problem. They are called one shot.

Positive Edge

This is the instruction used to detect the positive edge or signal change stat of “0” to “1”. When it detects a change in the input signal from “0” to “1”, it will allow the power to flow only that much of the time that signal is changing its stat from “0” to “1”. After that, it will stop the power to flow.

Ladder Logic


Positive Edge Contact and Coil

The positive edge sensing contact looks a lot like the examine if closed instruction. In fact, it has the same symbol except this one has a P in the white space:

Ladder Logic
Also, the functionality is a little different. Because this instruction is not evaluating the state of a bit, but rather the change in the state of a bit. A positive change or a change from 0 to 1 to be more specific.

Positive Transition Coil

For Positive Transition Coils, aka (Rising-Edge) One-Shots or P-Coils, if all input conditions are TRUE, no functions have faulted out, and power flow has reached the coil at the end of the rung, it becomes TRUE for only a single scan of the OCS. Once the scan returns to this location in the program logic, the output will become FALSE,


Ladder Logic

The Positive Transition Coil should always be addressed to some intermediate, internal variable for use elsewhere in program logic. Addressing it to a physical output would only result in the output being active for a couple of milliseconds, if at all. In Debug mode, the TRUE state will likely never display due to the single scan the output is on and the much slower nature of Debug mode

Negative Edge

This instruction detects the change in the signal stat from “1” to “0”. It will allow the power to flow when it detects a negative change in the input signal like “1” to “0” and allow the power only this much of time. After that, it will stop the power to flow.

Ladder Logic


Negative Edge Contact and Coil

You will find the negative edge detection both as a contact and as a coil instruction. Again, they are called one-shots because they are only active in the same scan time as the transition from 1 to 0 happens.

Ladder Logic

Negative Transition Coil

For Negative Transition Coils, aka (Falling-Edge) One-Shots or N-Coils, all input conditions must become TRUE in order for power flow to reach the output. However, the output will not become active until those conditions are again FALSE, at which point the Negative Transition Coil will become TRUE for only a single scan of the OCS.


Ladder logic

The Negative Transition Coil should always be addressed to some intermediate, internal variable for use elsewhere in program logic. Addressing it to a physical output would only result in the output being active for a couple of milliseconds, if at all. In Debug mode, the TRUE state will likely never display due to the single scan the output is on and the much slower nature of Debug mode.

FAQ

1. What is the function of set reset in PLC?

Set/Reset, also known as latch/unlatch, is used in programmable logic controllers (PLCs) to control the output status based on specific input conditions. The concept is used in holding the condition of an output after a momentary input is triggered once, such as energizing a motor starter or indicator light.

2.What is the difference between set and reset?

Set refers to the simple action of setting that value, as above. Reset refers to placing that value back into that variable after it has set and been changed, either by the program or through some other way.

3.What is positive and negative edge?

When there is a transition from 0 to 1 it is named as positive edge triggered and when the clock pulse makes a transition from high to low i.e. from 1 to 0 it is termed as negative edge triggered.

4.What is edge detection in PLC?

The edge detection is represented by an output Boolean signal, which has the value 1 (true) only during a time step, when the state change has occurred, Signal edge detection is useful in for timers, counters or clock resets, for signal state updates or for triggering a set of functions / algorithms.

5.What is the difference between rising and falling edges?

In electronics, a signal edge is a transition of a digital signal from low to high or from high to low: A rising edge (or positive edge) is the low-to-high transition. A falling edge (or negative edge) is the high-to-low transition.

Read more 
PLC Programming - Basic Knowledge
Ladder Logic Programming Instructions – Part 1

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.