SCL Postive Edge detection in Dword

MOeZ

Lifetime Supporting Member
Join Date
Nov 2009
Location
singapore
Posts
101
Dear Expert,

SCL Newbie question :oops:, 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. :oops:
 
Dear Expert,

SCL Newbie question :oops:, 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. :oops:


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 .....
 
// 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).
 
Last edited:
Many Thanks Jesper and Kour! will try it out Jesper Method (y) and Still have no idea yet Kour's Idea to use Famous XOR! :unsure:
 

Similar Topics

HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
61
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
550
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
314
Hi everyone, I am new to this amazing world of PLC, well... I mean, in practice, since I already knew electronics, programming languages, IT, and...
Replies
7
Views
649
Hi all, This is my first post; I am new to PLC Controls stuff and English is not my native language, so I apologize in advance if something is...
Replies
4
Views
509
Back
Top Bottom