LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MSB first or LSB first

Solved!
Go to solution

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"

0 Kudos
Message 1 of 3
(5,196 Views)

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.

 

 

0 Kudos
Message 2 of 3
(5,158 Views)
Solution
Accepted by topic author OATTelecom

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).

0 Kudos
Message 3 of 3
(5,151 Views)