Counting when sensor changes to false in SCL

SamuVim

Member
Join Date
May 2021
Location
Denmark
Posts
2
Hi,

I have a sensor that is FALSE when it is triggered, and a setup with boxes running past the sensor.

I need to count how many boxes go past, is there a way to count +1 only when the sensor switches from TRUE to FALSE? I tried looking at rising edge default function and some suggestions on google, but can not figure it out. Which variables (and of what type) should I create to achieve this counter?

Thanks a lot!!

Samu
 
Something like this:
Code:
IF (NOT Sensor) AND Sensor_mem THEN
  Count := Count + 1 ;
END_IF ;
Sensor_mem := Sensor ;

N.B. Before anyone point out that I have added an 'unnecessary' parantesis, then I like to explicitly add parantheses that help visualize the logical order of the boolean formulas. I dislike it when something is implicit.
 
...I dislike it when something is implicit.


+1e6; no complaint here; I work in too many languages to bother wasting neurons memorizing the precedence rules for each one.



We could reverse the order of the tests, then there is nothing implicit (I think).
 

Similar Topics

Hey All, I am looking for advice on the best prox sensor or device to use in this application. Customer wants to be able to count potatoes...
Replies
16
Views
5,126
Hello everyone, We have can counting sensors on all our lines, i am sure all of us know why. So, one of our lines has started counting more cans...
Replies
12
Views
3,280
Hi guys, I've an enquiry from our mechanical department to help source out a kind of sensor that is able to detect & count the nuts in a nuts...
Replies
41
Views
8,466
I am looking for sensor to "Count" product..Now before anyone jumps in and says use a photoeye..thats what we have..however its not accurate...
Replies
30
Views
6,045
Hello I am looking for tips on how to count the duration of a given function and then how to display it on the hmi panel in the hh:mm:ss format...
Replies
4
Views
1,702
Back
Top Bottom