LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Expression node bit shift

Is this a bug or am I just thinking about this wrong?  The attached VI shows a U8 going through an expression node where the expression is "x << y".  I've tried multiple versions of y and as soon as y becomes large enough to shift all the original 1's off the U8, the result becomes 0xFF instead of 0x00.  I would assume that its intent was to match C's functionality since it matches C's syntax but this does not appear to be the case.
 
Any suggestions or is this a bug?
Thanks
Systems Engineering - National Instruments
0 Kudos
Message 1 of 2
(2,917 Views)
Hey Andy,
 
Thank you for contacting National Instruments.  It does look like that is acting strangely.  However, we do have a Logical Shift VI that I believe accomplishes what you are looking for.
 
On the Block Diagram, go to Programming>>Numeric>>Data Manipulation>>Logical Shift.
 
It takes two inputs, x and y, with x being the original number, and y being the number of bits you want to shift.  It looks like it will clear out to 00 once all the bits have been shifted over.
 
Let me know if you any questions!
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 2 of 2
(2,870 Views)