Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Comparator

For general discussion related FlowStone

Comparator

Postby BobF » Thu Jun 09, 2016 7:57 pm

Hell gang,

I could really use some help from someone who knows code and could code me a simple stream comparator. What I need is this. Comparison of relative states of plus and minus inputs. If the in(+)is greater than in(-), the output is 1, if in(+) is less than in(-), the output is 0. Only two states 0 or 1. This does have to work with streams as I am comparing two waveforms and need a stream of 1's and 0's from the the two compared streams.
For those that know electronics, this is just a simple analog voltage comparator.

Well that's it. Hope someone can help. If so many thanks in advance.
Later then, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: Comparator

Postby adamszabo » Thu Jun 09, 2016 8:11 pm

If I understood correctly you have two inputs? Then this should do it:

Code: Select all
streamin in1;
streamin in2;
streamout out;

out = (in1 > in2) & 1;


If in1 is greater than in2 it outputs 1, otherwise 0
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Comparator

Postby tulamide » Thu Jun 09, 2016 8:17 pm

Sadly I can't help with the code. But as I understand it, the absolute value is to be compared:

+0.6|-0.7

abs(0.7) > abs(0.6)

sign of the greater is negative, so output is 0


+0.6|-0.4

abs(0.6) > abs(0.4)

sign of the greater is positive, so output is 1

the abs function is pretty cpu heavy I've heard, so I don't know how to realize it with DSP.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Comparator

Postby BobF » Sun Jun 12, 2016 3:36 am

Thanks, adamszabo and tulamide,

Sorry this is late. Just been busy like we all are.

Comments, tips, hits, suggestions, and so on are always very much appreciated.

Later then, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm


Return to General

Who is online

Users browsing this forum: Google [Bot] and 73 guests