Positive edge detection in SCL (S7)

Lesa

Member
Join Date
Sep 2006
Location
Novi Sad
Posts
71
Does edge detection instruction exist in SCL or I have to write it myself?

Can it be done like this?

Code:
if x and not x_old then
     //code
end_if
x_old := x;
 
You have to write it yourself as you have done so. I would create another boolean variable (called xEdgeDetected for example) and use it as follows:

Code:
xEdgeDetected:= x and not x_old;
x_old:=x;
 
if xEdgeDetected then
//code
end_if

Just to keep the edge detection logic in one place (instead of what may be a large chunk of code splitting it up) and to make it obvious what you are intending.
 
I tried to search "System Software for S7-300/400 System and Standard Functions" PDF for F_TRIG or R_TRIG but no result, also search S7 help but nothing.

Does S7 fully supports IEC 61131-3? In S7 help "IEC Functions" is no R_TRIG or F_TRIG?
 
From the siemens web-site:

"S7-SCL is a text-based high-level language based on the IEC 61131-3 language Structured Text (ST). "

It doesn't claim to be compliant, just based on IEC61131-3
 
In many cases it is a matter of acting on real input conditions. In many other cases, it is a matter of proceeding based on history.

In other words... How did the current set of input conditions come to be? And what should be done in terms of how that particular set of input conditions came to be.
 
Sorry, I don't understand this either.

Give us a hint, Terry. What are you talking about?:confused:
 
Ken M,

Any system that is designed to react to nothing more than current input conditions is nothing more than a mechanical switch handler.

You might as well revert to the days when all automated mechanical activity was based on the state of a set of mechanical toggles.

In doing so, you are not taking advantage of sensory input in terms of the product being processed!

At the very least, responding to a particular signal, one that might be logically out of sequence, might potentially create a bad, if not worse, situation!

Any "SMART" System should KNOW how a process should unfold. If it doesn't unfold as expected, then, in terms of the processor, that should be a "cause-to-pause"!

How can a Processor KNOW anything??? The processor should be comparing the unfolding activity to the expected activity described in a model of that activity! If there is a discrepancy, there is a problem. It's that simple.

The "model", that is, the expectation, should be "coded in".

It's called... Human Think!

If you are controlling a system manually you can clearly see when things are not unfolding as they should. In doing so, would you ignore the fact that something is unfolding wrong??? Of course you wouldn't! You would, or should, STOP the process rather than continuing to run only making matters worse!

Do you have any idea what I'm talking about? I can explain further.
 
Hi Terry,

I think I get it now.
I expected this thread to unfold along the lines of whether there was an in-built 'edge' instruction in Siemens SCL. Up to post #6 everything seemed to be OK. But then at post #7 there was an event I couldn't map in to my model of what should be happening. Lesa raised an interrupt at post #8 and I repeated the warning at post #10.

I still don't know what "WAS-xxx" is, or how it counts, and why it counts BIG TIME. And given that extent of ignorance on my part, is it any wonder that whether it ALWAYS works or not is completely lost on me? I'm guessing this is a reference to a typical error message in, say, Java like "expected xxx but was xxx "

But what has this to do with the existence of one-shots in SCL?

Still puzzled

Ken:unsure:
 
Hmmm...

I believe what Terry related with great brevity was simply coding in historical awareness: "wa_xxx" vs "is_now_xxx".
Correct me if I am wrong on this Terry, but the point is to not program solely on existing inputs.

regards,

Thomas
 
Thanks Thomas,

But I still can't see what that had to do with the original question or the price of wet fish. I'm just completely mystified why Terry threw it in here. It seems it could have been included in any thread and had just as much relevance.

Ken
 

Similar Topics

How to make in STL(S7-300) potivite or negative bridge. I want to start pump only on positive edge of the bit "start_pump"
Replies
7
Views
4,258
As you can see I wrote I timer before the step (before JCN M042) In this step I now need to set something on a rising edge of this step 4...
Replies
2
Views
4,060
Hello I have got a problem with positive edge from "system clock memory byte" in Tia Portal. I would like to change byte"system clock memory"...
Replies
27
Views
3,537
Can anyone see why i am not getting an output on this? it is detecting a rising edge and saying that it is true but going any further to the...
Replies
5
Views
2,368
I am using Portal for the first time and I am simply trying to do a one shot. My code wasn't working so I made a new network with all new tags so...
Replies
7
Views
2,441
Back
Top Bottom