I have a timer. Currently, the output of a 'greater than' module connects to its input like so:
Currently the timer starts running when the output of the greater than module is 1, and continues counting until the greater than module produces a 0.
But what i'd like is that every time that the greater than module outputs a 1, the timer gets reset, but when it outputs a zero, the timer ignores it and continues counting.
Can anyone see how i need to set this up?, is there a module that i've overlooked that could help?
Thanks!
Reset a running timer from a comparison module?
-
- KVRist
- Topic Starter
- 453 posts since 10 Jul, 2003 from Rotterdam
-
- KVRist
- 92 posts since 29 Nov, 2007
Here you go cbit. The file Timer_1sec_reset.sbc up at http://dscrofani.junker.org will do what you want.
I included a display to view the value of the running timer to check it. Change the input constant on the far left from 0 to 1 to 2 or whatever to note that the counter resets and starts running again every time a 1 is input. The output of your greater then module replaces this input constant.
I assumed that you wanted the timer to start again even if the greater than held a 1 output (cause that's what was so hard about this thing anyway). To do it I used a delay - it's self explanatory. Depending on how long you want to wait before the timer runs after a rest if the greater than holds 1 output - change this delay time.
It turns out that I wanted something like this a year ago for a compressor circuit. I never did figure it out then. I am going to put this to good use.
It's important to keep the 0.6 constants because if you actually use 1 then there is a time when the two outputs add to give the timer an input of 2 and it resets again when this happens. This causes an annoying double reset when the input both arrives at a 1 and leaves a 1. Using 0.6 fixes it since 0.6+0.6=1.2 is still interpreted by the timer as a 1 input.
Finally - I used a new version of Sb for this. I just dl'd and installed tonight. So if the whole thing doesn't show at all it's because of this. Update, if you don't have it already, is available right at www.sonicbirth.com. Don't know if it's here at KVR too.
Hope this solves your problem.
dscro
I included a display to view the value of the running timer to check it. Change the input constant on the far left from 0 to 1 to 2 or whatever to note that the counter resets and starts running again every time a 1 is input. The output of your greater then module replaces this input constant.
I assumed that you wanted the timer to start again even if the greater than held a 1 output (cause that's what was so hard about this thing anyway). To do it I used a delay - it's self explanatory. Depending on how long you want to wait before the timer runs after a rest if the greater than holds 1 output - change this delay time.
It turns out that I wanted something like this a year ago for a compressor circuit. I never did figure it out then. I am going to put this to good use.
It's important to keep the 0.6 constants because if you actually use 1 then there is a time when the two outputs add to give the timer an input of 2 and it resets again when this happens. This causes an annoying double reset when the input both arrives at a 1 and leaves a 1. Using 0.6 fixes it since 0.6+0.6=1.2 is still interpreted by the timer as a 1 input.
Finally - I used a new version of Sb for this. I just dl'd and installed tonight. So if the whole thing doesn't show at all it's because of this. Update, if you don't have it already, is available right at www.sonicbirth.com. Don't know if it's here at KVR too.
Hope this solves your problem.
dscro
-
- KVRist
- Topic Starter
- 453 posts since 10 Jul, 2003 from Rotterdam
Thats great! dscro. Thanks for posting it. It'll take me a little while to understand exactly what youe done