09-09-2008 03:51 PM
We have a feedback from our instrument contains a string of 4 bytes representing a 32-bit real number but we can not convert it, can some one help?
Here is a string: 'ffffffee'
Is there any VI or sample available?
Thank for help
09-09-2008 03:58 PM
09-09-2008 04:13 PM
09-09-2008 04:13 PM
09-09-2008 04:43 PM
Thank for help but I did try & look does not work. I attach my VI so that you can see why I am not right (the number suppose to be -1.xxxxxxxE-3
Can you help one more time?
09-09-2008 05:25 PM
Yes, it is a right STRING, however it is required doing 2 complement ... because it is a negative number!
I did have another number & it is said to do conversion already (no need to do 2 complement) bf 53 4c 78 ... but I still in-vain to convert it!
You have any idea?
09-09-2008 05:46 PM
SORRY gentlements, those 2 strings I was mistaken from the inteprete reading, it shows the equivalent number from the byte (ie: '0' ---> 0x03 = 30), so sorry about confuse all of you.
Therefore: 'fffffffee' is real 4 bytes of ÿÿÿî
I hope that now we are clear than before! Sorry abot the confusion!
09-09-2008 09:30 PM - edited 09-09-2008 09:31 PM
OK, This is getting silly. Please attach a VI that has the correct string as a diagram constant. Or change your string display to hex and paste the hex representation.
Do you know if your string is little endian or big endian? ALso tell us what SGL number you expexct as result.
Most likely, all you need is typecast the string. (If it is little endian, use "unflatten from string" and select the correct byte order)
09-09-2008 09:47 PM
plit string wrote:Yes, it is a right STRING, however it is required doing 2 complement ... because it is a negative number!
Typecasting will take care of this automatically.
plit string wrote:I did have another number & it is said to do conversion already (no need to do 2 complement) bf 53 4c 78 ... but I still in-vain to convert it!
My code would turn a strong of BF53 4C78 (in hex display) into a SGL of -0.825386. Sounds reasonable?
09-10-2008 07:40 AM
By your explanation, I did setup the instrument with corrected 64-bit reading (since in LabView does not have the 32-bit but DOUBLE instead), so that I use 8 bytes then it works perfectly as your suggested casting
Many thanks