Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

in C = d1 + d2 << 8 + d3 << 16-----how to do in labview

ok
0 Kudos
Message 1 of 4
(3,073 Views)
One way is to use the range function. add d1 + d2 and wire into the bottom(lower boundary) and wire a constant 16 into the upper boundary. Right click on the diamonds and make sure they are hollow meaning not inclusive. Your formula is only < not <=
Wire d3 to an add function and hardwire 8 into the add function and then wire the result to the input of the range vi. Your formula uses = not = = . If you want the limited value, just connent to the float output. If you are just concerned that 8 + d3 is in range, the range vi has a boolean output inRange.
0 Kudos
Message 2 of 4
(3,073 Views)
In C, the operator << means shift left. From the appearance of the original poster's expression, it looks like each operand is probably an 8-bit value and the original poster wants to construct a 24-bit value by shifting and adding. (But the actual written expression computes different values from what the poster probably wanted. Hint: parentheses are your friends :-)))

Anyway, operators < and <= wouldn't help.
0 Kudos
Message 3 of 4
(3,073 Views)
The logical shifts can be accomplished by using the logical shift VI available from the Advanced->Data Manipulation pallete. See the VI attached below for an example of how this line of C code is implemented in LabVIEW with the correct operator precedence.

Regards,

Matt Friedman
National Instruments
0 Kudos
Message 4 of 4
(3,073 Views)