Rising edge (oneshot) in TIA14 SCL

Michal_dk

Member
Join Date
Oct 2007
Location
Vejen
Posts
153
Hi Guys!

I'm writing a Function Block and I want an internal counter to reset at the call of this FB.

Now I have searched at it seems I can't use the EN bit, as it is apparently not available. But the ENO bit is, and to me the EN and ENO should both be TRUE as soon as the FB is enabled?

The code I'm using is like this:

#Edge := ENO AND NOT #EN_OLD;
#EN_OLD := ENO;

IF #Edge = TRUE THEN
#ii := 0;
END:IF;

#Edge is a Temp Variable and #EN_OLD is a Static Variable.

It does not work, the counter stays at what ever value I have it on when enabling the FB.

If I change ENO to %I0.0, then it all works as expected.

Is there something I have misunderstood?

My goal is to avoid having a separate enabling input on the FB, but there may not be a way around it.

Best regards,

Michal
 
That sounds to me as a quirky way to reset a counter, i.e. by calling-not calling-then calling again an FB. And I dont see how it can work. How can the FB "know" that since its last execution there have been CPU cycles where it was not executed ? Only the outside calling program can know this.

If you have a counter, you should have a dedicated reset function, in other words an input pin on the FB for this purpose.
 
Hi Jesper!

What I'm trying to accomplish is that the code in my FB is only executed once for every call. So if the user keeps the enabling signal high my FB will still only execute the code or part of the code once (the counter is the pointer for my sequence).

So if I do have to scrap the idea of using the enabling of the FB, The input pin will also be the enabling pin for the code inside the FB. Meaning that for all intents and purposes I will have two enabling signals for the FB - not nice, but it may be the only way around.
And i do realize that you do not have to put a condition in front of the enabling of the FB, so you could still have only one condition for executing the FB.

best regards,

Michal
 
You won't be able to get it to work that way, you'll need a separate input. What it comes down to is that it rarely makes sense to use the EN to not call an FB.

The usual best practice is to have the first import be something like "REQ" or "EXEC" and then do a one shot off of that.
 
I think your best bet is to use the one shot instruction inside the FB and trigger it from somewhere outside the block when you want to reset. The block will interpret the signal as you specify inside. The usage of the ENO is not something I've typically done unless I'm tying multiple ladder instructions together, or with a shift.
 
I have a piece of code that reads/writes to a frequency converter to get or set a parameter. The rest of the code is working with the value of the parameter presenting it to the HMI system in a way that is better understandable than what is comming "raw".

Aside from not needing/wanting to spam the communication with something that will most likely only need to be executed once every day, the IO words used to communicate to the drive might also be used for other parameter readings/writings and I do not want too much hassle if that is needed.

But I have made the FB with a separate activation input and it is working as i want it, thanks for the input all of you :)
 

Similar Topics

Hi all, Does any body know what the rising edge code is for GX Works in structured text. I have several manuals but can't find anything relating...
Replies
9
Views
2,502
Hi everyone first of all. This is first question in the forum. I am using HSC application. I'm reading A and B pulse count. 1 round of the motor...
Replies
12
Views
4,316
Hi All, Does anyone of you know what is the function of rising and falling edges? I essentially want to trigger a timer once the state of a coil...
Replies
8
Views
4,697
i need to capture the time between the rising edge of 1 pulse and the rising edge of the next pulse after it. i have a flow meter that gives a...
Replies
16
Views
5,046
Hi! Anyone can share example of GE Proficy Rising Edge Structured Text? I have found text as below InstanceOfR_TRIG( CLK := inBool, Q =>...
Replies
6
Views
2,898
Back
Top Bottom