06-08-2019 08:11 AM
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
Solved! Go to Solution.
06-08-2019 10:21 AM - edited 06-08-2019 10:25 AM
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.
06-08-2019 10:47 AM - edited 06-08-2019 11:05 AM
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?
06-08-2019 11:52 AM
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
06-08-2019 11:54 AM
This is the datasheet
06-08-2019 12:40 PM - edited 06-08-2019 12:45 PM
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.
06-08-2019 12:53 PM - edited 06-08-2019 12:54 PM
If you receive the green string, here's how to parse it (not all elements are decimal numbers, so process accordingly):
06-08-2019 01:03 PM
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
06-08-2019 01:05 PM
But sir i have one doubt is there any relation ship between both strings can i get decimal data from the hex string??
06-08-2019 01:23 PM
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.