LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

8 bytes string to DBL decimal number

Does anybidy help me. I am getting angry of Labview because i could'n find proper instructions how to solve such a simple problem as is convert 8 bytes string to decimal number.I tried myself using Labview tools, examples and tried to find into diskusion forum! But nothing!?! I found similar problems but without good answer or an example. Does anybody wonts to spent a litle time and create an example: convert 8 bytes(in bits 011001 100011...) string to DBL decimal number 9 etc 123.25.
I am developing an application wich will control an instrument over internet. I am receiving a message on TCP/IP port 443 in ASCII code and i have to decode that message into numbers.I am using the message as string and converted it into an array and fr
om array i got spreadsheet string which is composed of bytes (1 byte 8 bytes 1 byte 1 byte 8 bytes...)I know how to extract bytes from that string but i dont know how to convert them into DBL decimal numbers.I tried different tools like Type cast..unflatten data...but without results. To get data from the port i am using VISA read...but same result with TCP/IP read vi.Can i change something in Visaread.vi and get data in numbers not in ASCII code?
Ok i am just cople of weeks with Labview..and i know that i have to learn..but i need not only directions but also examples since a lot of examples in Labview have poor explanation
I appreciate any help in advance
Regards
0 Kudos
Message 1 of 7
(4,536 Views)
On the functions pallete go to strings, string/number conversion and see if
there's something you can use. I would guess Fract/Exp String to Number is
what you want.

"Ketmen" wrote in message
news:5065000000080000002C6D0000-1031838699000@exchange.ni.com...
> Does anybidy help me. I am getting angry of Labview because i could'n
> find proper instructions how to solve such a simple problem as is
> convert 8 bytes string to decimal number.I tried myself using Labview
> tools, examples and tried to find into diskusion forum! But nothing!?!
> I found similar problems but without good answer or an example. Does
> anybody wonts to spent a litle time and create an example: convert 8
> bytes(in bits 011001 100011...) string to DBL decimal number 9 etc
> 123.
25.
> I am developing an application wich will control an instrument over
> internet. I am receiving a message on TCP/IP port 443 in ASCII code
> and i have to decode that message into numbers.I am using the message
> as string and converted it into an array and from array i got
> spreadsheet string which is composed of bytes (1 byte 8 bytes 1 byte 1
> byte 8 bytes...)I know how to extract bytes from that string but i
> dont know how to convert them into DBL decimal numbers.I tried
> different tools like Type cast..unflatten data...but without results.
> To get data from the port i am using VISA read...but same result with
> TCP/IP read vi.Can i change something in Visaread.vi and get data in
> numbers not in ASCII code?
> Ok i am just cople of weeks with Labview..and i know that i have to
> learn..but i need not only directions but also examples since a lot of
> examples in Labview have poor explanation
> I appreciate any help in advance
> Regards
0 Kudos
Message 2 of 7
(4,536 Views)
Ketmen,

The Type Cast or Unflatten from String are the right function to use. Here is the interesting thing if you are getting bad values. How is the TCP being sent? LabVIEW stores all numerics as Big Endian data. If you other program is sending the data as a Little Endian data type, then you will get the right number, just not in the right form. Try using the byte swapping functions on the incomming data to do a full byte swap of all of your data.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 3 of 7
(4,536 Views)
Randy, i tried Type Cast and unflatten data..but something is wrong..or i dont understand the syntax. Could you please create a short example: convert 8 bytes in binary form into double precision number...like: 10011 10100 .... to etc. 123.45..and i will learn from the example...will be helpfull example converting double precision number to 8 bytes..
I am receiving data in Big Endian... only problem i have is convert data into DBL...i greatlly eppreciate your help.
Happy New Year
Ketmen
0 Kudos
Message 4 of 7
(4,536 Views)
Ketmen,

Happy New Year to you as well. Try this quick simple little example and see if it is enough for you. When you send a number from your TCP application, double check though this example that you are getting the same string through TCP.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 5 of 7
(4,536 Views)
Randy thank you very much, i created the decoder. Now i want to send a command to the instrument using VISA WRITE modul (TCP/IP).I am not sure how to send the command using VISA. I have to send two numbers 10 as U8(1 byte) and etc. 25.5 as DBL (8 byte) as one string. Which format suppose to be that string HEX, binary or ASCII and how to create one string from the two numbers which is ready to be sent to VISA write? Could you please create an example which will show me how to solve problem.
Thanks
0 Kudos
Message 6 of 7
(4,536 Views)
Ketmen,

All you need to do is to concatenate the strings you need together. I do not know what format you will need, you instrument manual should tell you that. Please go through the LabVIEW tutorial and go through the string shipping examples for help with the string functions.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 7 of 7
(4,536 Views)