12-06-2012 12:48 AM
The data is in16bit, little-endian, 2’complement format.
Eg. “60 02” is a little-endian notation, it equals to 0x0260, 608 in decimal.
Also “FF FB” means -1025.
May I know how to do the convert in LV, the volumn is big.
Any suggestion, thanks.
Solved! Go to Solution.
12-06-2012 12:52 AM
Use the Swap Bytes VI under the "Numeric...Data Manipulation...palette. It will swap the upper and lower 8 bits of your word or array of words. You can then display it in whatever format you like.
12-06-2012 01:00 AM
Thanks, the “60 02” is a string, and after swap, may I know how to convert further, thanks.
12-06-2012 01:12 AM
@alex. wrote:
Thanks, the “60 02” is a string, and after swap, may I know how to convert further, thanks.
Sorry, thought you wanted to convert "endianess"....Swap Bytes doesn't work on strings.
Can you give an example of more than just two values so I can see more of the input formatting?
12-06-2012 01:17 AM
It is a string array displayed by '\' Code as attached.
12-06-2012 01:24 AM
Use string subset Vi to get lower and upper bytes.
Use concanet string to swap upper and lower bytes.
Use hexadecimal string to number conversion to convert it in decimal.
check the condition if it is greater than 65535 then subtract no. with this value to get negative no.
12-06-2012 01:34 AM
Tried but cannot find 'concanet string', where is it, any suggestion, thanks.
12-06-2012 01:58 AM
@alex. wrote:
It is a string array displayed by '\' Code as attached.
That is your raw data - all the numeric values are there. All you need to do is typecast the string to an array of U16 and then swap bytes (as previously), as shown below. If you don't know where to find a certain function, search the palette using the search box (or search the help).
12-06-2012 02:08 AM
Sorry It was Concatenate Strings
Every function is under strings pallete
12-06-2012 02:09 AM
Hi Natahand,
I think typecasting would not show negative numbers.