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 12th, 2021, 06:10 AM   #1
xzen
Lifetime Supporting Member
Norway

xzen is offline
 
xzen's Avatar
 
Join Date: Jun 2006
Location: Oslo
Posts: 90
Edge trigging in ST or SCL

What is your best practice for edge trigging in structured text language?

Code:
#condition := (Value1 > 0 OR NOT Tag1) AND Tag2;
IF #condition_positive_edge THEN
    some_code();
END_IF;
__________________
http://www.slauto.no
  Reply With Quote
Old January 12th, 2021, 06:22 AM   #2
ojz0r
Member
Sweden

ojz0r is offline
 
Join Date: Feb 2009
Location: 127.0.0.1
Posts: 330
Use the built in functions (IEC 61131-3):
- R_Trig: Rising edge
- F_Trig: Falling edge
  Reply With Quote
Old January 12th, 2021, 07:19 AM   #3
AustralIan
Member
Germany

AustralIan is offline
 
Join Date: Jan 2013
Location: Germany
Posts: 1,214
+1 R_Trig
  Reply With Quote
Old January 12th, 2021, 07:55 AM   #4
Manglemender
Member
United Kingdom

Manglemender is offline
 
Join Date: Jul 2007
Location: Lancashire
Posts: 1,185
If you wish to code it yourself then:

IF Condition AND NOT Condition_Memory
Some Code
End IF

Condition_Memory = Condition
  Reply With Quote
Old January 12th, 2021, 02:18 PM   #5
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,562
Jesper's post 9 years ago, same as Manglemenders If condition on ST.


Quote:
Originally Posted by JesperMP View Post
Dont think there is a one-shot block for SCL.
But it is trivial to code.

signal_oneshot_ON := signal_input AND NOT signal_mem ; // generate the ON oneshot
signal_oneshot_OFF := NOT signal_input AND signal_mem ; // generate the OFF oneshot
signal_mem := signal_input ; store the status of the input
  Reply With Quote
Old January 13th, 2021, 01:35 PM   #6
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,583
Not sure if it's in all ST packages but in CoDeSys (at least in v3.5) you can set a bit for a positive or negative edge trigger. The 'P' indicates positive edge, for Negative edge it would be an 'N'

Attached Images
File Type: png Trigger.png (1.6 KB, 58 views)
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  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
Rising edge (oneshot) in TIA14 SCL Michal_dk LIVE PLC Questions And Answers 7 January 19th, 2018 01:54 AM
SCL Postive Edge detection in Dword MOeZ LIVE PLC Questions And Answers 3 January 23rd, 2013 03:33 AM
ST SCL question (swap words) userxyz LIVE PLC Questions And Answers 1 February 3rd, 2009 04:59 AM
Is SCL almost = ST (structure text) ? userxyz LIVE PLC Questions And Answers 10 May 16th, 2007 09:53 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 09:48 AM.


.