Bitwise calculations

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
joma
Posts: 7
Joined: Thu Sep 02, 2004 3:59 am
Location: Germany, near Frankfurt

Bitwise calculations

Post by joma »

Hi,

it would be great :D (and add much value to Dplot :!:) if one could do bitwise calculations (AND, OR, XOR, SHIFT) on the data using the "operate on ..." command (and of caus for funktion f(x) ... as well). This would e.g. allow to check for closed/opened ports in a microcontroller based system, one could even think if some sort of logic analyser.

Greetings

Jo
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

That's easy enough - I'll look into it.

The only catch I can think of is the input would have to be truncated to an integer for these to make sense.
Visualize Your Data
support@dplot.com
joma
Posts: 7
Joined: Thu Sep 02, 2004 3:59 am
Location: Germany, near Frankfurt

Thanks

Post by joma »

Hi David,

great news! I'm looking forward to try it. Of cause there has to be an intrinsic truncation in the function (like "(long)floor(y)" or sth. like that)

With best regards

Jo :D
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Here is the first stab at it showing AND and OR functions with a simple example. XOR and NOT are also in there, but not shown simply because the graph gets too messy.

Image

If you have a real-world meaningful example you'd like to try out, send it to me. Or you can try out the new function parser yourself. Exit DPlot if it is running and download http://www.dplot.com/fparser.dll and save to the folder where dplot.exe resides, overwriting the existing version.

Syntax, in C-speak:
AND(y,z) returns (floor(y) & floor(z))
NOT(y,z) returns (floor(y) & ~floor(z))
OR(y,z) returns (floor(y) | floor(z))
XOR(y,z) returns (floor(y) ^ floor(z))

And thanks for the suggestion.
Visualize Your Data
support@dplot.com
joma
Posts: 7
Joined: Thu Sep 02, 2004 3:59 am
Location: Germany, near Frankfurt

Post by joma »

Hi David,

many thanks for your first version. It just works fine if one uses the dot as decimal symbol. But as you may know, I live in Germany, and therefore - unfortunately - our data use the decimal comma. With this as setting under options, one only gets (different) errror messages using the bitwise calculations.

Greetings

Jo
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

That's how all functions (and macro commands) work and this is not likely to change.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Correction. This:
NOT(y,z) returns (floor(y) & ~floor(z))

makes no sense to do. Now

NOT(y) returns ~floor(y)

If you want the previous answer you could use AND(y,NOT(z))

This will be available soon - probably this coming weekend.
Visualize Your Data
support@dplot.com
Post Reply