12-18-2005 03:27 PM
12-18-2005 04:31 PM - edited 12-18-2005 04:31 PM
This seems to be a bug in the formula node under LabVIEW 7.1. It works fine in LabVIEW 8.0.
Of course it seems to be a bit of an overkill to use the formula node for this, just use plain boolean AND operation and it will work as expected ;).
Message Edited by altenbach on 12-18-2005 02:35 PM
12-18-2005 04:47 PM
12-18-2005 05:02 PM
12-19-2005 06:11 PM
Thanks for that link. It's very interesting and useful.
Ananda
04-16-2009 03:27 PM
Man, this has been driving me nuts. I'd like to use a formula node to do bit manipulation on U32 values that are being peeked from and poked back into 32-bit registers. What I find is that, if I ever do either "bitwise and" (&) or the "bitwise or" (|), if the most significant bit of the right side of the expression is 1, then the output of the expression is always zero. Some examples:
0xFFFFFFFF & 0x7FFFFFFF = 0x7FFFFFFF
0xFFFFFFFF & 0x80000000 = 0x00000000
0x00000000 | 0x7FFFFFFF = 0x7FFFFFFF
0xFFFFFFFF | 0x80000000 = 0x00000000
Apparently, this is a bug I can demonstrate in LabView 8.5 and 8.6. The same operation on a diagram seems to work as expected. It just would have been nicer to use a formula node, since it's more straightforward when doing even slightly elaborate bit-banging.
-Mark
04-16-2009 05:35 PM
Post a VI that demonstrates this and have the values saved in the controls as the default.
I tried using LV 8.6.1 and did not see a problem.
04-16-2009 05:41 PM
This vi will demonstrate the difference between bitwise and/or in a formula node vs in a diagram. Basically, given a U32 "n" and a U32 hard-coded constant "p", if the most significant bit of "p" is set, the result of a either bitwise-or or bitwise-and of "n" is 0 when done in a formula node. Geez it's hard to word that clearly for some reason. 😄
-Mark
04-16-2009 05:42 PM
BTW, I get the same behavior in 8.5 (this machine) and 8.6 (my lab machine). Please tell me I've overlooked something really dumb. -M
04-16-2009 08:35 PM - edited 04-16-2009 08:42 PM
Something very odd about that. I am posting an expanded version of what you did and experimented with different methods and datatypes.
All I can say is that I found two work arounds.
1. Pass the constant in through an input connector which was done in the original post and thus why I said it worked fine for me in LV 8.6
2. Don't list the constant as hex but put it in as a decimal number.
There are probably a lot more combinations of things to try to truly search out the extent of this and to see if it truly is a bug.
1. Play with signed vs. unsigned datatypes some more
2. Play with OR vs. AND vs. other boolean operations.
3. Play with other integer representations such as 8 bit and 16 bit.