LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Brushing up on text base reading somebody elses formula node

Solved!
Go to solution

I need to brush up on my text base skills.  I am reading somebody elses code and it contains this formula node.  Any help understanding the logic inside or seeing a LabVIEW equivelent would be much appreciated.

 

formula node

0 Kudos
Message 1 of 10
(3,170 Views)

Can you attach the actual formula node in a new VI. I doubt that we currently see the full code.

0 Kudos
Message 2 of 10
(3,138 Views)

Very odd snippet of code.

All but the first line should be self explanitory.  Everything on the first line though are bitwise operators.

Basically it is stating that if the Nth bit of variable A is a 1 (N being j-i) then set X=2

 

For example: A = 11, j=6, i=3, f=8

A (in binary) is 1011.  So A right shifted 3 places (6-3) = 1 so 1 & 0x01 = 1 -- so set X = 2

 

Edit: fixed a typo

Message 3 of 10
(3,137 Views)

Here is the whole node.  Thanks

0 Kudos
Message 4 of 10
(3,123 Views)

Hey Don, can you explain the &0x01 portion?

 

Thanks

0 Kudos
Message 5 of 10
(3,120 Views)

That is masking out all the other bits and only looking at the 0th (1's) bit so you can get a simple 0 or 1, rather than other numbers in the event other bits are set within the number that you don't care about.

Message 6 of 10
(3,116 Views)

@Pat_H wrote:

Here is the whole node.  Thanks


Ah, thanks. Now we see the curly brace at the end. 😄

0 Kudos
Message 7 of 10
(3,108 Views)

Pat_H wrote:

formula node



What is up with the 'f' outside the box?
0 Kudos
Message 8 of 10
(3,100 Views)
Solution
Accepted by Pat_H

How about some nice G code to look at.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(3,097 Views)

Thank you all!

0 Kudos
Message 10 of 10
(3,072 Views)