You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old January 17th, 2018, 04:02 AM   #1
Michal_dk
Member
Denmark

Michal_dk is offline
 
Michal_dk's Avatar
 
Join Date: Oct 2007
Location: Vejen
Posts: 149
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
  Reply With Quote
Old January 17th, 2018, 04:54 AM   #2
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 14,621
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
  Reply With Quote
Old January 17th, 2018, 05:05 AM   #3
Michal_dk
Member
Denmark

Michal_dk is offline
 
Michal_dk's Avatar
 
Join Date: Oct 2007
Location: Vejen
Posts: 149
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
  Reply With Quote
Old January 17th, 2018, 05:59 AM   #4
mk42
Lifetime Supporting Member
United States

mk42 is offline
 
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.
  Reply With Quote
Old January 17th, 2018, 11:07 AM   #5
dwoodlock
Member
United States

dwoodlock is offline
 
dwoodlock's Avatar
 
Join Date: Nov 2012
Location: Cincy/nKY
Posts: 450
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.
  Reply With Quote
Old January 17th, 2018, 02:35 PM   #6
Dirt
Member
Sweden

Dirt is offline
 
Join Date: Apr 2008
Location: Stockholm
Posts: 292
Deleted.

Last edited by Dirt; January 17th, 2018 at 02:49 PM.
  Reply With Quote
Old January 18th, 2018, 03:14 PM   #7
JBA-DK
Member
Denmark

JBA-DK is offline
 
Join Date: Sep 2015
Location: Haderslev
Posts: 58
What is your purpose for making a block working like this?
  Reply With Quote
Old January 19th, 2018, 01:54 AM   #8
Michal_dk
Member
Denmark

Michal_dk is offline
 
Michal_dk's Avatar
 
Join Date: Oct 2007
Location: Vejen
Posts: 149
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 :-)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
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


All times are GMT -5. The time now is 01:41 AM.


.