12-14-2010 06:09 AM
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'.
12-14-2010 06:14 AM
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) :
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
12-13-2012 05:19 AM
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
12-13-2012 05:54 AM
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)?
12-13-2012 06:06 AM
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
12-13-2012 06:13 AM
how about this
12-13-2012 06:14 AM
thanks PhillipBrooks
but I'm getting data form sensor as string (Pink wire), more Info see my last replay.
Regards
Alhaidar
12-13-2012 06:53 AM
You could do this.
Of course this only works correctly if the string length is even.
12-14-2012 01:06 PM
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.
12-15-2012 04:58 AM - edited 12-15-2012 04:59 AM
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.