Positive and Negative Edge Transition
Positive and Negative Edge Transition
Positive and Negative Edge Transition
Welcome to Siemens S7 1200 tutorials. In this lesson we will see bit logic operations on positive and
negative edge. Okay, positive and negative edge and after that we'll have an example of that. So let's see
what is this positive and negative edge? So let's start with a positive edge - Scan operand. Now what
does this mean? if you see the symbol it's similar to NO contact, but with a "P" in the in the middle, it
indicate positive okay. It says the state of this contact... let me take a Pen... State of this contact is true
when a positive transition "OFF to ON" is indicated on the assigned bit I0.0, the bit M0.0 will be on for
one clock cycle okay. So, it sounds complicated, but try to understand, it says this bit will be true if you
have a positive transition on I0.0, it means this input which is connected to the PLC here, and if we have
a switch here, if this switch goes from off to on, okay, this is the OFF state, and on the top it's the ON
state okay. So, if you have any input connected to our first input, which is I0.0, has OFF to ON which is
which is like pressing a switch or getting a signal on the sensor or could be pressing of a limit switch if
that state goes from OFF to ON, there will be a pulse detected at M0.0, this bit will be on, this bit will be
on for one clock cycle. This is here. So a physical input I0.0 get.. will be scanned. And if the result is from
OFF to ON this bit will be on for one.. for one cycle. And this cycle is typically equivalent to your PLC scan
cycle. Okay, if your PLC scan cycle is for let's say five millisecond, this will be on for five millisecond.
Okay, simple as that. So this is a positive edge. We'll see later on what will be the application of the bit
okay. So, let's see another this is negative edge - Scan operand, which have.. which has the "N" in the
middle, this is a contact again, this is the input. Now here we have an input I0.1 okay. So, take a pen,
yeah, this is this could be my second input I0.1, if this input has now it has ON to OFF transition, okay,
ON to OFF transition, which means this is if this is already ON, if if this goes off, at this particular instant,
at this particular instant, this bit M0.1, this bit will be on for one clock cycles, it means in both cases you
will have this bit, they will give you a pulse like this, both this bit will give you a pulse, its duration is
equal to PLC scan time, but this pulse will occur if you have ON to OFF transition, okay, and this pulse
will occur if we have OFF to ON transition. And here it's incorrect, it's not positive, it's negative, negative
transition, then you have this clock pulse. Okay, so we'll see it's example. So let's let's proceed So, the
only difference is it is having a pulse on positive transition, this is having a pulse on negative transition
okay. And it says that the P and N contact can be connected anywhere in the network, except at the end
of branch. So this means you can if you check your ladder, you can connect that anywhere. Let me
switch to my ladder, you can connect anywhere except at the last end of the branch. So this can be
connected anywhere okay. So let's see one timing diagram to understand this better. now have an
example here this is I0.0. My first input I0.0. If this goes on, the moment you press this button or any
input this goes on, you have a pulse of M0.0 here, this is the positive edge okay ON to OFF and as I told
you this duration is equal into your scan time Okay, duration of this pulse is equal to scan time. Now this
is a negative edge it means when you turn on I0.1 nothing will happen because this I0.1 is negative
transition. But when you turn off this bit, at this particular moment you have this M0.1, another edge, so
it is again a edge which is going from OFF to ON, it doesn't mean it has a downfall edge, negative edge it
doesn't mean that it has a downfall edge, it is not like this okay. It is again a positive edge. But occurs at
negative edge of your input. Okay. Try to understand that. That's how it makes a difference. This comes
at the start of the pulse. This comes at the end of the pulse. That's the only difference it has. Okay.
Internal
So let's move ahead. The question says write a logic to latch the motor when I0.0 goes from off to on
and unlatch the motor when this is this is I0.1 goes from on to off, okay. This is off to on, this is on to off.
So you can imagine that this one is off to on, this one is positive edge, this one is on to off, this is a
negative edge. Okay. And this is I, this is not U. Okay, so now we have two switches here, just like we
have it in a PLC. So what could be the logic, it's very simple, you take two edges, positive edge, and you
latch the motor with a positive edge. Now this latching will happen because the SET command needs a
pulse for this operation, okay. And you can unlatch it using a negative edge of the motor. So let's try that
in our Siemens TIA. So I'll take first, not this bit. I'll take a positive bit, this one, this you can also take
from here, bit logic operation. And here's the bit you can take it from here as well. So here comes my
input, which will be scanned, I0.0. And here will be the bit so I'm using M0.0. This is the internal bit of
my PLC, internal memory bits, you can use it as an auxiliary relays, okay. To this I'm using to set the
output, which is Q0.0. And in the parallel here, I will take a negative edge. So negative edge will come
here from this will be I0.1. And this, I'm taking M0.1, memory 2. This is not the emergency and i will
rename it as B and this I'm using to reset my output Q0.0. Okay, so I have my positive edge to set the
output, negative edge to reset the output. So what will happen if I turn on this one, this will be set. If I
turn off this one, this will remain set. If I turn on this one, nothing will happen. But if I turn off this one,
this will be reset. So let's check that and downloading this to my PLC, load. And I have to monitor and
here comes the PLC. Okay, I will keep it I will keep it here. Or maybe this is not rational, okay, I'll keep it
here. Or what I can do is I will make it float. And I will keep my PLC here. Okay, now this is fine. So this is
my first input and these two inputs are on, I'll put it off. Okay, so let's start from the beginning. First I
have I need a pulse from my first input 0.0. So I will turn on my input. And you can see that my output is
set because I gave a pulse. And this is true. Okay, now I will turn on my second input. But nothing will
happen if I turn it on. Why because it's a negative edge which is on to off transition okay. So when now
this is on, now when if I turn it off, a pulse will come which will reset the output. So this is on to off. So it
will output will be off only when the input goes off. Okay, it will be a little tough to understand this if you
are learning for the first time. But I will try to make you understand this logic more in our Factory IO
exercises, which you will find in the end of the session. This is a Factory IO, factory automation example,
which I'll be using to make these commands, you know, easy to understand to make more sense to this
course, using the software. Alright, so this was a basic about positive and negative transition. And if you
want to see its FBD solution, it is much similar, you have this block with P, and you have the addresses
I0.0. similar to this one. And if I take a pen, now this part of the logic, it's here, and that's part of the
logic, it's here. This is the positive, this it the negative. This is used to set the output and this is used to
reset the output. This is much similar when you switch from ladder to FBD because it's more similar in
programming just the representation is different. Okay,
so this was about simple positive and negative edge. Now let's look at another example. It says bit logic
instruction P trigger and N trigger. Its function is more similar but it has a different application. Now it
says the Q output power flow or the logic state is true when a positive transition OFF two ON is detected
on CLK power flow in ladder diagram. So this is the input where it needs positive transition now here we
don't have any input here just like in the last one we have an input here, but here we don't have any
input. Besides we have we can have a logic here. So it says scan RLO result of last operation okay. So the
result of last operation here will be considered to make transition. So let's see an example. Now we have
two inputs A and B. So it's I0.0, I0.1 these are connected in parallel and its output is given to this P
trigger. So now that this P trigger will give you, this will give you a pulse if this is true or this is true okay
if any of this is true, this will give you a pulse, just a pulse okay. So, because this is off to on, if this is off
Internal
to on, you will get a pulse, or if this is off to on, you will get a pulse okay. So, this is positive edge trigger.
Similarly, we have a negative edge trigger which is called N trigger, scan RLO. In this case you have a
negative pulse, not a negative pulse, but negative triggered pulse, in this case the difference is when you
have and let me take Yeah, when you have on to off pulse at any of this input x or y, this will give you a
pulse. So this is off to on Okay, you can see that this is off to on but this is on to off pulse as what we
understand in the last exercise, this is the example for that. So let's take a look at the example of test
instruction in the next slide. Write in logic to latch the motor when either of I0.0 or I0.1 goes from off to
on, positive edge and unlatch the motor when the either I0.2 or I0.3 goes from on to off, negative edge.
So Here is example, two are connected in parallel and this is going to P trigger and this is going to SET
motor and these are negative trigger going to RESET the motor. Okay, so this is pretty easy. So if you see
its example in FBD, it will look like this, two gates connected in parallel, OR, P trigger and motor. So now
this time I'm going to make this logic and FBD and you can check this logic whether it's working or not
okay, so we have two inputs to P trigger, two inputs to N trigger. So let's move to our software and I will
go monitoring off, delete this logic Yeah, and we switch to FBD from here Okay, so we have 2 input in
AND, so I'll go to take an AND gate here, I will write I0.0, I0.1 Okay, now the output goes to P trigger. So I
will find P trigger here, it goes to P trigger and here I have to give an address memory bit which will be
giving you a pulse and the output goes to set okay. It is going to set the instruction, set an output which
is mootor, could be a motor Q0.0. So, this logic says when any of the input is true, there will be a pulse
which will set the output, now we need to reset the output with negative edge so we need another AND
gate. I'm giving two another input I0.2, I0.3 I can change it to rename I can write "stop1" and I can
rename that to "stop2"
correct now I need a negative edge here. So I will take negative trigger, I will put M0.1, you must
remember that these addresses should not be same, if you are using M0.0 here you should not use it
anywhere else in the program. Take another bit. Then you will take a reset, Q0.0 the same address okay.
And you can rename this tag to "motor" so the logic is complete, let's download this and check this on
our PLC, load this is downloaded and I need to turn on the monitoring
Okay, I need this float window so that again see PLC and logic all together.
Okay, this is fine. I hope this is visible. Here's a PLC. Okay, now I will turn on my first input to check this
logic first, I'll turn on I0.0 and we'll have a positive edge and our output is on ,you see this is not green
now, because the edge will come and it will go. So this i s true because I is zero, I is one, this goes false
but output remains set, so the output is set now, I will reset this output using my I0.2, this input so, in
the PLC you can see that the input is true and the output is reset. Now not reset yet because the
negative so when I turn off this input, this will be reset like this okay. So, now, I will try the second case
with this input I0.1 This will set the output because this is in all connection. So, ouput is on now I will
turn on my this input I0.3, with the negative edge this will be reset.
This is on now I will turn it off, the output is off. So in both cases we have checked that that the positive
edge of I0.0, I0.1 is going to set the output and negative edge of I0.2 and I0.3 will reset the output. This
was the objective of our question in the presentation which we have just resolved. So this is about rising
and falling edge in our Siemens S7 1200. So let's review this lesson we have learned that the positive
edge contact is true when the positive transition off to on is detected on its operand operand.. this is
operand. This is it will just detect the detect the addres,s one single address. Negative edge contact is
true and the positive transition on to off detected on its operand and this is again incorrrect, this is this
Internal
is negative here, sorry for this inconvenience, this is negative Okay. Next it says P trigger contact is true
when instruction detects a change in the result of logic operation from zero to one, result of logic
operation okay. So, you can have multiple contacts in series or parallel to check that okay this is only for
operand, but this is for result of logic operation, could be a series of inputs or a parallel. So this is the
difference. Similarly N trigger is when you have a result of logic operation from one to zero. Okay, so
these are the this is the difference between two types of P trigger and N trigger. I hope this lesson
makes sense. And of course its application you will find in Factory IO video which was in this section. So
thank you for watching and if you need a copy of this presentation, you can find it in the course as in the
next session.
Internal