LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

From little Endian to big Endian

Hi guys, Is there a function in LabView 2010 to go from little endian to big endian? I want to change for example 'B0011000' to '001001B0'.

0 Kudos
Message 1 of 10
(18,627 Views)

Hello,

 

Yes, you do have that, here is the path to access it in the palette (my LabVIEW is 8.6 so the palette might be slightly different to yours) :

 

endian.jpg

 

You have a "swap byte function", "swap words", "split", "join", etc...

 

Everything you need 🙂

 

Hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 10
(18,625 Views)

Hi TiTOU 

I had the same problem, and your solution is not working for HEX number, do you have another solution, thanks in advance 

 

Regards

Alhaidar

0 Kudos
Message 3 of 10
(18,176 Views)

Using the swap bytes and swap words functions on a U32 will do what the original poster asked.

 

Are you working with a number (blue wire) or a string (pink wire)?

 

Swap Bytes and Words.PNG

Message 4 of 10
(18,167 Views)

Hello freinds

i found one sulution for 4 byte (if more/less add/delete replace substring blocks) .... if you have better one please share it ...

Regards

Alhaidar

Unbenannt.png

0 Kudos
Message 5 of 10
(18,160 Views)

how about this

Labview user
Message 6 of 10
(18,154 Views)

thanks PhillipBrooks

but I'm getting data form sensor as string (Pink wire), more Info see my last replay.

 

Regards

Alhaidar

0 Kudos
Message 7 of 10
(18,153 Views)

You could do this.

Of course this only works correctly if the string length is even.

String-LEBE.png

Message 8 of 10
(18,144 Views)

Combining a couple of these approaches into one that's a bit more reliable. It works for any length string that contains an integer number of 32-bit values; if you're dealing with 16-bit values, change the representation in the array.  LabVIEW is natively big-endian so this code reverses endianness.

to little endian.png

Message 9 of 10
(18,101 Views)

Assuming this is about the 4 byte sensor data only (which is actually a strange way to send in wrong endian order anyhow) I would think this is the most direct conversion. I prefer to convert string numbers into real numbers as soon as possible in a program. Makes things much easier to work with.

Byte swapping.png

Rolf Kalbermatter
My Blog
Message 10 of 10
(18,077 Views)