LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex string to decimal number

Hi,
 I may be getting a bit confused with the names 'Hex string, hex number, decimal string...' , i have a problem that goes like this...
 
       I have an serial input in the form of hex string '84B0 8520 8520 8520 8520 84B0 ' , ive converted it in hex number which looks like '84 B0 85 20 85 20 85 20 85' ,  
 
 Now im trying to find the decimal of the above string which according to me would be near to decimal 0.
 
On similar lines for the second case the hex string is 'FFF0 FFF8' , THIS
0 Kudos
Message 1 of 9
(4,124 Views)


S.G1. wrote:
 I may be getting a bit confused with the names 'Hex string, hex number, decimal string...' , i have a problem that goes like this...

You're not really making it any clearer, because you don't fully describe what you really have. 😉
 
First, please describe the string '84B0 8520 8520 8520 8520 84B0'
  1. Is this an binary string of lenght=12 and this is how it look like if your string is set to hex display?
  2. Is this a formatted ASCII string of lenght=29 consisting of characters 8,4, B,0, space, etc.
Now describe the "hex number" '84 B0 85 20 85 20 85 20 85' how did you do the "conversion"?
  1. Is this still a string? Formatted string?
  2. Is this an array of U8 set to hex display fornat?
  3. Us this a U64 number set to hex format?
  4. What happened to the trailing B0? How did the 84 change to 85?

S.G1. wrote:
 Now im trying to find the decimal of the above string which according to me would be near to decimal 0.

If this is really an integer, it is definitely NOT close to zero! Where did you get that idea? Is this flattened data? What should be the representation?
 
It would be much easier of you could attach a small VI that has your strings as a diagram constants. 😉
 

 
0 Kudos
Message 2 of 9
(4,105 Views)

Hi , I would like  to confirm that it is a binary string of length 12 bit, and this is how it looks in hex format display.

 

I am attaching the vi so that you can get a clear picture

 

thankx

subhash

0 Kudos
Message 3 of 9
(4,044 Views)
Hi SG1,

in the attachment you see what Altenbach already suggested in a very similar threadSmiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(4,033 Views)
Hi ,
        thankx for taking interest ,
 
 The details that i know are that the ADC supplies the data which is shown in the above vi and it is 12 bit ADC, data is sent as two bytes . now i would like to represent it in the decimal format so that the corresponding 0v/gnd data shows a line which is near to zero and same case follows with the 5v data that should represent some decimal value . Scaling may be done as per the user. 
      
           The problem that im facing is how can i convert this data . Any suggestions ? Can you send me a vi that can do the work?
0 Kudos
Message 5 of 9
(4,020 Views)
Hi SG1,

see attachment - usually you just mask the lower 12 bits...

Your values doesn't seem to fit this scheme though...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(4,014 Views)


S.G1. wrote:
 The details that i know are that the ADC supplies the data which is shown in the above vi and it is 12 bit ADC, data is sent as two bytes . now i would like to represent it in the decimal format so that the corresponding 0v/gnd data shows a line which is near to zero and same case follows with the 5v data that should represent some decimal value.

You really need to explain to us what you mean by "close to zero" and what you mean by "decimal". Are you possibly talking about a fixed point implementation?
0 Kudos
Message 7 of 9
(3,998 Views)

Hi Gerd , thankx for helping me out , actually the data which the ADC gave is not in standard format, so i wasent able to figure out the type of format and was beating around the bush.

 

Thankx

Subhash

0 Kudos
Message 8 of 9
(3,969 Views)

Hi alen , thankx for helping me out , actually the data which the ADC gave is not in standard format, so i wasent able to figure out the type of format and was beating around the bush.

 

Thankx

Subhash

0 Kudos
Message 9 of 9
(3,968 Views)