LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how could I choose some bytes from HEX string and then convert it to a decimal value?

Hi I am working with an OMRON E5EN temperature controller using VISA serial to get data, I send the Read from Variable Area command and get this string  in hexa 0230 3130 3030 3030 3130 3130 3030 3030 3030 3030 3041 3203 71 or .01000001010000000000A2.q in ASCII this string means:

02 STX

3031 3030 Node and subadress

3030 End Code Normal Completion

3031 3031 Command Read from Variable Area

3030 3030 respt code Normal completion

3030 3030 3030 4132 Hexadecimal A2 = 162  (this is the temperature data that I want to show in decimal)

03 ETX

71 Block Check Character

 

I want to choose the eight bytes for the temperature data and convert it to a decimal number. I have seen the examples to convert a Hexa string to decimal but I do not know how to choose the specifics bytes that I need.

 

I have look for a driver but i didn´t find any. I am a beginner so please include especific topics for me to study in your answer.

 

Thanks

Carlos Fuentes Silva Queretaro Mexico 

0 Kudos
Message 1 of 5
(4,436 Views)
If you're getting the string like that all you really need to do is to use the String Subset function to pick off the characters that correspond to the 8 bytes you want and the just feed that to the Hexadecimal String to Number function, as shown below:





Message Edited by smercurio_fc on 01-04-2008 05:34 PM
Message 2 of 5
(4,428 Views)

If the response always has the temperature starting with byte 15 and is always 8 bytes in length, you can use the String Subset function to get those bytes out of the string.  Then use Hex String to Number to convert to a decimal number.

Well someone already beat me to the solution:



Message Edited by tbob on 01-04-2008 04:42 PM
- tbob

Inventor of the WORM Global
Message 3 of 5
(4,423 Views)
Hi
 
Thanks for your help I have done it and it is exactly what I needed 
 
Carlos Fuentes Queretaro Mexico
0 Kudos
Message 4 of 5
(4,394 Views)

Could you share this driver with me? I also want to read data from OMROM E5AZ temperature controller.

 

Thank you in advanced.

 

 

ronke@163.com

0 Kudos
Message 5 of 5
(3,795 Views)