09-30-2016 01:01 PM
I have byte "00011100 " but I want to swape this byte to " 00111000" . what should I do ?
ps. I try to use tool box " swape byte"
Solved! Go to Solution.
09-30-2016 04:49 PM - edited 09-30-2016 04:52 PM
Swap bytes.vi changes order of the bytes (not bits) in 16 bit integer.
Is it rotate or reverse?
What should 11011100 convert to? 00111011 (reverse) or 10111001 (rotate left, carrying first bit to the last)?
Inverse: Insert inverse array (boolean array of bits in the loop).
Rotate: Insert Numeric-> Data manupulation -> Rotate left with Carry in the loop before Convert to boolean array.
Edit: One more thing: move To U8 conversion inside the loop. Basics of data conversion: avoid converting arrays, it is better to build array of correct type.
09-30-2016 05:17 PM - edited 09-30-2016 05:22 PM
None of this makes any sense.
You have a single character, turning into an array with a single U8 element (i.e. a single byte). To swap bytes, you need more than one. The output should not be a 2D array.
If you want to reverse the bits in the byte, user reverse array on the boolean array.
(and if you need to do this often, create a 256 entry lookup table instead).