Re: Schmitt triggers
Posted: Fri Jul 29, 2022 6:00 pm
Straight to the toolbox.
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
http://flowstone.co.uk/support/
Tepeix wrote:Here's a Tulamide Switch in asm !)
... Also a new Schmith Trigger ...
streamin in; streamout out;
streamin t; streamin u;
int abs=2147483647;
int sgn=-2147483648;
float n5=0.5;
float a=0; float b=0;
movaps xmm5,n5;
movaps xmm6,sgn;
movaps xmm7,abs;
movaps xmm0,in;
movaps xmm4,xmm0;
subps xmm0,t;
//sign(in-t)//
andps xmm0,xmm6;
orps xmm0,xmm5;
//sign - last sign > positive if last one negative
movaps xmm1,a;
movaps a,xmm0;
subps xmm0,xmm1;
movaps xmm1,xmm0;
//+abs could not be negative
andps xmm1,xmm7;
addps xmm0,xmm1;
addps xmm0,out;
//sign(in-u)//
subps xmm4,u;
andps xmm4,xmm6;
orps xmm4,xmm5;
//sign - last sign
movaps xmm1,b;
movaps b,xmm4;
subps xmm4,xmm1;
//-abs could not be positive
movaps xmm1,xmm4;
andps xmm1,xmm7;
subps xmm4,xmm1;
//
addps xmm0,xmm4;
// "min+max" > x<0.5 or x>0.5 => x=-0.5 or 0.5
subps xmm0,xmm5;
andps xmm0,xmm6;
orps xmm0,xmm5;
movaps out,xmm0;