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 22nd, 2013, 01:27 AM   #1
MOeZ
Lifetime Supporting Member
Singapore

MOeZ is offline
 
MOeZ's Avatar
 
Join Date: Nov 2009
Location: singapore
Posts: 101
SCL Postive Edge detection in Dword

Dear Expert,

SCL Newbie question , i want to set POS_EDGE Detection output if any of bits changes in DWORD ? i been thinking and still not have correct answer yet.

Currently, i called "POSTIVE_EDGE" Detect Function block 32 times in STAT area of Main FB and check couples of bool one by one and is worked. But i wanted to improve performance in this FB and Hope somebody can help me with better
way of SCL? Thanks in adv.
__________________
Everything Should be made as simple as possible, but not simpler.
Albert Einstein
  Reply With Quote
Old January 22nd, 2013, 04:50 AM   #2
kour
Member
Tunisia

kour is offline
 
Join Date: Jan 2013
Location: Tunis
Posts: 1
Quote:
Originally Posted by MOeZ View Post
Dear Expert,

SCL Newbie question , i want to set POS_EDGE Detection output if any of bits changes in DWORD ? i been thinking and still not have correct answer yet.

Currently, i called "POSTIVE_EDGE" Detect Function block 32 times in STAT area of Main FB and check couples of bool one by one and is worked. But i wanted to improve performance in this FB and Hope somebody can help me with better
way of SCL? Thanks in adv.

Hi
I can give you an idea, the implementation of SCL it gets easier.
consider using the famous XOR, and here is the XOR function.

at the beginning and at the first execution, you double your word "EDGE" initializes a word "MD0" for example 0.puis you enter a boucle.Si MD0 XOR front is equal to 0, otherwise you a front and you will have the same posistion. 1: bit 1, 3: two front in the bit 1 and 2 .....
  Reply With Quote
Old January 22nd, 2013, 04:56 AM   #3
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 14,614
// the bits in oneshotword will be oneshots of the bits in sourceword formatted as WORD or DWORD
"oneshotword" := "sourceword" AND NOT "memword" ;
"memword" := "sourceword" ;

edit:
(deleted .. I made the mistake thinking that logical word operations have to be made on INTs or DINTs).
__________________
Jesper
See my profile interests for Q&A

Last edited by JesperMP; January 22nd, 2013 at 05:18 AM.
  Reply With Quote
Old January 23rd, 2013, 03:33 AM   #4
MOeZ
Lifetime Supporting Member
Singapore

MOeZ is offline
 
MOeZ's Avatar
 
Join Date: Nov 2009
Location: singapore
Posts: 101
Many Thanks Jesper and Kour! will try it out Jesper Method and Still have no idea yet Kour's Idea to use Famous XOR!
__________________
Everything Should be made as simple as possible, but not simpler.
Albert Einstein
  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
LOGO - edge detection tweazer LIVE PLC Questions And Answers 3 August 26th, 2012 12:58 AM
Move DWORD S7 in SCL cjd1965 LIVE PLC Questions And Answers 13 April 23rd, 2012 10:47 AM
Step7 Detecting Positive Edge In SCL mosama LIVE PLC Questions And Answers 8 May 11th, 2011 04:25 AM
Confused "again" S7 indirect Thim LIVE PLC Questions And Answers 17 July 22nd, 2008 05:47 PM
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 08:47 AM.


.