Page 1 of 2
Double Gate?
Posted: Sun Mar 08, 2020 9:08 pm
by tulamide
Would it be possible?
What I'm thinking of is a gate that closes when a signal is higher than threshold A, but then stays closed until the signal is lower than threshold B. Since I wouldn't want to use it directly, it should somehow output false for closed and true for opened.
Any examples would be appreciated. And please remember that I am not able to build it myself from scratch. So any advice that's just describing things as text, is well-meant but useless for me. So don't waste your time, if you don't plan to also add a schematic.
Thank you anyway!
Re: Double Gate?
Posted: Sun Mar 08, 2020 10:20 pm
by trogluddite
Sounds like what you need is a "Schmitt Trigger" (a gate with hysteresis). Unfortunately I seem have hit the dreaded "attachment quota" (I said I would jinx myself last time I mentioned it!). Here's a
DropBox Link instead (it's the "inverse" version that fits what you described).
Re: Double Gate?
Posted: Mon Mar 09, 2020 11:39 am
by tulamide
trogluddite wrote:Sounds like what you need is a "Schmitt Trigger" (a gate with hysteresis). Unfortunately I seem have hit the dreaded "attachment quota" (I said I would jinx myself last time I mentioned it!). Here's a
DropBox Link instead (it's the "inverse" version that fits what you described).
Thank you very much! Yes, this inverted Schmitt Trigger was exactly what I was looking for! Of course, it's a black box for me, but it doesn't matter, because it works. Awesome!
Re: Double Gate?
Posted: Mon Mar 09, 2020 1:11 pm
by adamszabo
tulamide wrote:Of course, it's a black box for me
I converted the assembly to Ruby I hope it helps to understand better

Code: Select all
#green float inputs: @in, @lo, @hi
def init
@gate = false
end
def event(i,v,t)
@gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
output 0, @gate == false
end
Re: Double Gate?
Posted: Mon Mar 09, 2020 2:01 pm
by tulamide
adamszabo wrote:I converted the assembly to Ruby I hope it helps to understand better

Code: Select all
#green float inputs: @in, @lo, @hi
def init
@gate = false
end
def event(i,v,t)
@gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
output 0, @gate == false
end
It does! You just need to pass the output in parentheses: output 0, (@gate == false)
And it brings up a question
The Schmitt Trigger uses only 8 instructions (wow!), while the inverted one uses 11. In the Ruby version, I can make an inverted Schmitt Trigger just by using 'not': output 0, !(@gate == false)
Is that not possible in fewer than 3 instructions?
Re: Double Gate?
Posted: Mon Mar 09, 2020 3:00 pm
by adamszabo
tulamide wrote:Is that not possible in fewer than 3 instructions?
I believe you can use the "andnps" (and not) instruction on the normal Schmitt trigger, I dont know how to apply it from the top of my head right now.
Re: Double Gate?
Posted: Mon Mar 09, 2020 4:14 pm
by trogluddite
I think Adam's probably right about the inversion. It's a module I made years ago, and the assembler didn't used to recognise any inverting logic opcodes, so a compare with zero may have been the only way to do it (the pslld get you a zero by bit-shifting all the 1s out of a register - much quicker than loading a zero constant from memory). It might even be possible to refactor it so that the inversion isn't a separate step these days.
Re: Double Gate?
Posted: Tue Mar 10, 2020 8:16 am
by tulamide
I understand. And it's totally fine. It was no criticism, I was just curious after I understood what's going on, thanks to Adam's Ruby translation.
I'm totally fine with the versions!
Thanks guys

Re: Double Gate?
Posted: Wed Mar 11, 2020 2:26 pm
by wlangfor@uoguelph.ca
I've used schmidt, but have you tried doing it in blue?
You can convert the linear to db using a logarithm and then you output the db you wish to reduce by and send to a Sam Mungall VCA linear db ASM code optimized by Barak.
It saves a percent or two in CPU and is often faster.
Here's a link to My new tools that should help you get there:
http://dsprobotics.com/support/viewtopic.php?f=3&t=38514Take a look at how I optimized a limiter for ideas?
And BTW, instead of release, why not just use Trog's ASM slide to reduce the db? It's the same as release in most ways. A good idea maybe, anyways, GL.
Re: Double Gate?
Posted: Wed May 20, 2020 1:25 pm
by tiffy
tulamide wrote:adamszabo wrote:I converted the assembly to Ruby I hope it helps to understand better

Code: Select all
#green float inputs: @in, @lo, @hi
def init
@gate = false
end
def event(i,v,t)
@gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
output 0, @gate == false
end
It does! You just need to pass the output in parentheses: output 0, (@gate == false)
And it brings up a question
The Schmitt Trigger uses only 8 instructions (wow!), while the inverted one uses 11. In the Ruby version, I can make an inverted Schmitt Trigger just by using 'not': output 0, !(@gate == false)
Is that not possible in fewer than 3 instructions?
Hi guys, I wanted to use this Ruby version of the Inverted Schmidt-Trigger connected to a knob as input, however apart from the required Bool pulse it provides at its output it also let through unwanted triggers from the knob. Is there a method in Ruby to completely stop those unwanted triggers coming from the knob to appear at the output of the Schmidt-Trigger? Thanks.