LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hexadecimal Big String to Decimal Numbers

Solved!
Go to solution

Hello, Good Evening

I am facing a problem in bit conversion from hexadecimal string to decimal number the problem is that i am using

INPUT String = 242C01002CAAAA2C 2B 30 30 2E 30 30 35 2C 2B 30 30 2E 33 34 34 2C 2D 30 39 2E 37 35 38 2C 2B 30 30 36 2E 33 38 30 2C 2B 30 30 30 2E 30 32 33 2C 2D 30 30 31 2E 39 35 33 2C 2D 30 2E 30 30 31 32 32 32 2C 2D 30 2E 30 30 30 34 35 30 2C 2D 30 2E 30 30 31 32 31 38 2C 33 2C 2B 33 32 2E 

and i am separating this with 2C wherever 2C is present the string is separated from there and stored in an array as shown in pictures attached with this but when i am taking those string to convert into decimal first three strings which aren't separated with "space" in between them shows the correct value but when string comes with space in between them it doesn't show the exact value please help

Download All
0 Kudos
Message 1 of 30
(4,184 Views)

If you attach an example VI, make sure that the input string contains typical default data so we can see what you are working with.

 

(Fill the input with the exact string as received, then right-click..data operation...make current value default. Repeat for the "comparing" control. Save the VI under a new name and attach it here again).

 

Who wrote this code? Why all the type mismatches? Why all the backwards wires? What exactly is the purpose of the code leading to the "Numeric 3" indicator? Also, if you want the elements of an array in order, you don't need to wire the indices of "Index array". Still, it would seem more logical to use an array indicator for simplicity.

0 Kudos
Message 2 of 30
(4,153 Views)

Also note that some of your hex formatted strings have more than 8 characters, meaning you need a 64bit integer when scanning.

 

Do you have any ideas on what numbers you expect from the above sample string? What does the data represent? Some strings have 18 digits, so they won't even fit into U64. Please explain. Are you sure the leading "2B" and 2D" are part of the number?

 

The following is definitely wrong, but maybe it could give you some ideas. Where does that string come from? Do you have documentation?

 

ScanSpecialString.png

 

 

0 Kudos
Message 3 of 30
(4,147 Views)

This the Data Sheet of my training program i have show all the output as given in the string at different different displays and i have to convert this string into those numbers given above the stings in the datasheet kindly please help

0 Kudos
Message 4 of 30
(4,135 Views)
0 Kudos
Message 5 of 30
(4,134 Views)

Do you also have a manual? What is the difference between green and yellow? It seems yellow is just the same as green, but displayed in hex.

 

What prevents you from attach a VI containing a "real" received string?

 

Looks like green is the real received string, so the numbers between commas are already in decimal format. The yellow part shows it in hex, which is irrelevant.

0 Kudos
Message 6 of 30
(4,118 Views)
Solution
Accepted by topic author Anjaney

If you receive the green string, here's how to parse it (not all elements are decimal numbers, so process accordingly):

 

ScanSpecialString2.png

0 Kudos
Message 7 of 30
(4,105 Views)

Thank you Sir for your help this will help me in keep on continuing my training and sir i don't have any manual regarding this i was given this data only

0 Kudos
Message 8 of 30
(4,097 Views)

But sir i have one doubt is there any relation ship between both strings can i get decimal data from the hex string??

0 Kudos
Message 9 of 30
(4,094 Views)

The two strings (green vs yellow) are identical, just displayed differently. I guess I don't understand your question.  The yellow hex string corresponds to the ASCII encoding of the decimal numbers between commas.

 

You need to understand the difference between hex display of a string (any possible character value) and hex formatted numbers (only characters 0..F allowed).

 

Here is your exact SAME string in two different display modes (normal vs hex. right-click to select). Hex display is mostly useful if there are non-displayable characters, which is not the case here.

 

ScanSpecialString3.png

0 Kudos
Message 10 of 30
(4,086 Views)