![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
|
Rising edge (oneshot) in TIA14 SCL
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 |
![]() |
![]() |
#2 |
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper ![]() See my profile interests for Q&A
|
![]() |
![]() |
#3 |
Member
|
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 |
![]() |
![]() |
#4 |
Lifetime Supporting Member
![]() ![]() Join Date: Jun 2013
Location: MI
Posts: 2,667
|
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. |
![]() |
![]() |
#5 |
Member
|
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.
|
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: Apr 2008
Location: Stockholm
Posts: 292
|
Deleted.
Last edited by Dirt; January 17th, 2018 at 02:49 PM. |
![]() |
![]() |
#7 |
Member
![]() ![]() Join Date: Sep 2015
Location: Haderslev
Posts: 58
|
What is your purpose for making a block working like this?
|
![]() |
![]() |
#8 |
Member
|
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 :-) |
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Zelio soft laddet rising edge. | Karsten | LIVE PLC Questions And Answers | 1 | June 30th, 2016 04:37 PM |
Siemens Rising Edge One Shot Instruction | obi1987 | LIVE PLC Questions And Answers | 1 | September 16th, 2014 06:46 AM |
SCL Postive Edge detection in Dword | MOeZ | LIVE PLC Questions And Answers | 3 | January 23rd, 2013 03:33 AM |
Step7 Detecting Positive Edge In SCL | mosama | LIVE PLC Questions And Answers | 8 | May 11th, 2011 04:25 AM |
Positive edge detection in SCL (S7) | Lesa | LIVE PLC Questions And Answers | 17 | October 5th, 2006 08:22 PM |