Jump to content

Bitwise Operation


apostolakisl

Recommended Posts

Posted

This may be complex or it may be a simple add on. But adding bitwise capacity to ISY programming could have use. In particular, CAI webcontrol has bitwise variable setting/testing and with the added integration between the two, having bitwise control in ISY would allow for more efficient processing of data between the two. Perhaps there are other uses as well.

 

FYI, if your wondering. Bitwise operations mean that you are able to address each bit of a multibit number independently. In other words, you can test or alter each zero or one of a number expressed in binary. Like 100000 is the binary of 32. In bitwise logic, you can alter each 0/1 or test the value of each. "If bit6 is 1 then whatever" would look at the place sixth from the right to see if it is a one (which it is) and thus execute the then.

Posted
So the only reason this would help is to send multi-meaning bytes and words to the CAI instead of just whole variables?

Not true...you could use a single variable to hold many flags. If I have some programs that requires 4 true/false flags, I could put them in a single variable. As it is now, I'd have to clutter up my variables with *_Flag1, *_Flag2, etc.

Posted

With all the and's or's shifts etc, it seems a lot more complicated then it needs to be to just compare the 4 flags. to use just one you could just use "levels" of values based on powers of 2. If it's even it is one value, odd another, less than 0 another, greater than 0 another. There you have all 4 flags in one variable.

 

Now if the ISY cannot do those comparisons then we have another enhancement request.

Posted
With all the and's or's shifts etc, it seems a lot more complicated then it needs to be to just compare the 4 flags. to use just one you could just use "levels" of values based on powers of 2. If it's even it is one value, odd another, less than 0 another, greater than 0 another. There you have all 4 flags in one variable.

First of all, the ISY cannot do "is odd" or "is even"... Second of all, your example is only 2 flags...you have "odd vs even" and "positive vs negative". I would also argue that "more complicated then(sic) it needs to be" depends on the user. To programmers, bitwise operations and using bitmasks is a natural approach.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...