Counter that discards inputs after set time

Join Date
Apr 2013
Location
Christchurch
Posts
6
Hi there,
I have just begun to learn plc programming in the last few days and I am trying to get my head around ladder logic. I have run into my first real problem which is that I am trying to make a counter that counts up when the input becomes true and will count down when the input becomes older than a set time. I have sort of found a way that will do it but it can only cope with a small count using a network for every time the input is pressed, this will not work efficiently for large systems.
Does anyone have any advice for a rookie on this problem?

I have thought about trying to use the real time counter to store the time when the input is set true into an array, then evaluating the array for all inputs when the time is true. But that seems to be going way over my head. And I wouldn’t know where to start.
Thanks in advance!
Cheers
Nick
 
edit
https://docs.google.com/file/d/0B9eosVmNcgvQUF9LZXpaLW5Fd0E/edit?usp=sharing

If the link works you can see one way of doing it.
 
This is what i came up with, i ran into a few bugs with it, i dont want to have a rung for each time the input will be pressed.
Thanks for your help so far! i am just looking at the code now trying to make it work for me!

Counter.jpg
 
I have just used a verson of your code and what is happening is that it is counting down one every x seconds. which is getting closer to what i need but it is not counting down at the same rate in which the input is pressed.
 
it is not counting down at the same rate in which the input is pressed.

Look for a one shot instruction for the button
 
Last edited:
Im assuming that the one shot is a rising edge trigger? I have one there and its doing the job but if i press the button in quick succession three times the timer still counts down with intervals of x seconds between each down count.
Sorry if that isnt what you ment, i cant find any reference to a one shot instruction in the help files, just goingt to have a look through the net now.
 
your correct..rising edge trigger.

Why 3 timers doing the same thing?

I suspect you need a normally closed button to energise a timer when the button is not pressed and use that timer to count down... with perhaps a rising edge trigger on the timer Q bit driving the countdown.

Maybe explain a bit more clearly what your trying to achieve

Edit: Post 3 looks like a solution to me..i didn't open it earlier
 
Last edited:
The three timers are not doing the same thing, the first is energizing when the count is 1 and count down 1, the second when the count is 2 and will count down 1 ect. i would need 100 networks if i wanted to count up and down from 100.

Ok ill try to explain it more clearly,
i would like to detect how many times a button is pressed in the last x seconds. so that if it is pressed say 10 times the output will be true. but any true inputs older than x seconds are not included in the count.
Im not sure if that explains it much better but i am struggling to word it any better :)
 
Nick,

I think I understand what you are trying to do a little better. Lets just use 10 minute has our time. You want only the counts that happened in the last 10 minutes to be part of the count. I need to think about this for minute to figure out the best way. And they are all coming from the same input? This got a little more complicated.

.... I'm working on it. Hopefully I can come up with something
 
Nick,

Just to clarify, if 10 minutes was our window time

someone presses the button 25 times in a row.
count = 25 time= 13:10
2 minutes later they press the button 1 more time
count = 26 time=13:12
8 minutes later no more inputs
count =1 time =13:20
count =0 time =13:22
 
I would use a FIFO, a bit longer than the max possible number of presses in 10 minutes.

On Press - One Shot - add a new FIFO entry with the current time.

Always test the oldest FIFO entry. if longer than 10 minutes before current time then remove FIFO entry.

Count equals number of FIFO entries.
 
I knew there was an instruction I didn't know about. I would have found it, it would have just taken me another hour or so. Another instruction for the tool belt! Sweet
 

Similar Topics

Hi Guys, I have a 1769-L24-QBFCB1 that has the OK light flashing on the embedded counter module. The manual states it is a resettable fault, but...
Replies
0
Views
98
Hey Everyone, After reading a lot on this forum and elsewhere I see not many are fond of the 1794-VHSC module. I can see to a degree as I was...
Replies
3
Views
146
Hello Folks, Has anyone configured a Momentum high speed counter on Unity 13.1. We need the wiring diagram for Momentum High speed counter and...
Replies
0
Views
73
Hi all, I am working with an incremental encoder (ABZ signals, 360 ppr (so 1440 counts per rev)) to replace the existing "manual" encoder wheel I...
Replies
51
Views
2,558
Hi y'all Just a quick question for using Rslogix 5000 I'm using a counter up bit with an analog signal (0-10V). When 10V is measured, counter...
Replies
5
Views
229
Back
Top Bottom