From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to number conversion- a very interesting observation

Your data is pure hex and there are no spaces between them. Your loop is does not do anything useful. HEX display is just cosmetic and does not change the underlying data..
 
What exactly do you want to do with these hex string? Maybe you want to convert them to numbers using typecasting?
 
Could you make a simple VI as follows:
  1. Create an indicator of the string right after the serial read.
  2. Run your VI.
  3. right click on the terminal of the above indicator and select "change to constant".
  4. Delete all the serial stuff, we can work with the simulated data and don't need your hardware.
  5. Give us some idea on what kind of output you want.
  6. Save and attach the VI.

This should be very simple! You are jumping through way too many hoops!

Message Edited by altenbach on 02-07-2006 06:00 PM

0 Kudos
Message 11 of 32
(1,902 Views)
thanx for replying..well i am going ahead and attaching the basicserialread.vi file....i am trying to convert it into decimal format but it does not allow me to do so...the data i believe is in binary format...


-innovator81

0 Kudos
Message 12 of 32
(1,859 Views)
Well, this does not help at all. Please try again!
 
As I said, once your string indicator contains data, right-click on its terminal on the diagram and select "Change to constant". Delete everything else (except this new constant containing your raw string as received), save the VI under a new name and attach it.
 
We don't have your hardware, so we cannot use serial to get a typical string as you can!
 

Message Edited by altenbach on 02-09-2006 08:27 PM

0 Kudos
Message 13 of 32
(1,853 Views)
Innovator81,
 
Hopefully the attached VI will demonstrate...
 
...that you can remove all the spaces without the loop/shift register - wire a TRUE constant to the "replace all" input of the "search and replace" function.
 
...presuming the input string is actually in hexadecimal string format (i.e. ASCII character codes 0,1,2,....,E,F  - and not binary, decimal string, etc) then the string can be converted into an numeric value - in this example I chose to convert to a 64 bit integer internal "representation".
 
...the remainder of the code illustrates how to display the numeric value in different formats (without converting to a string) - and also how to convert the numeric value into strings of different formats.
 
Mark.
0 Kudos
Message 14 of 32
(1,829 Views)
hello there,

I have the GPS data that comes out of the serial port copied onto text file..please let me know what kind of data it is and I need to convert it into decimal format..thanx

-innovator81
0 Kudos
Message 15 of 32
(1,799 Views)

The only thing that can be said is that it's clearly not an ASCII representation of hex, octal, or decimal - it appears to simply be lot's of bytes of binary, and could be interpreted in an almost endless number of different ways.

Why don't you know what the data format is - don't you have a manual for his device?

It's quite unrealistic to expect anyone to look at 38 bytes of binary and be able to tell you what it is.

0 Kudos
Message 16 of 32
(1,790 Views)
Maybe the serial output from your GPS is ASCII and all that is wrong is that your PC serial port settings are wrong. Looking at the data you posted it looks like it might be a baud rate issue.
 
David
0 Kudos
Message 17 of 32
(1,784 Views)
thanx for replying..well I know that it is binary data..all I am trying to do now is to convert it into decimal format..so I need to know how to proceed with it..which vi's would help me convert it into decimal format???

-innovator81
0 Kudos
Message 18 of 32
(1,775 Views)
If its binary then Mark H is absolutely right, you would need to know how to split up the bytes into something meaningful. I think we will need more info....
 
It might help if you told us what model you GPS is.
Also tell us what your labview program goal is?
What did you do to get the data you submitted earlier.
 
David
0 Kudos
Message 19 of 32
(1,748 Views)
If its binary then Mark H is absolutely right, you would need to know how to split up the bytes into something meaningful. I think we will need more info....
 
It might help if you told us what model you GPS is.
Also tell us what your labview program goal is?
What did you do to get the data you submitted earlier.
 
David
0 Kudos
Message 20 of 32
(1,749 Views)