minhtham Posted August 25, 2016 Share Posted August 25, 2016 I try to read data from a device and get on a string in which two characters are required data along, but it's in hex format. how to convert from hex to dec? Link to comment Share on other sites More sharing options...
minhtham Posted August 25, 2016 Author Share Posted August 25, 2016 example data is : 3D Link to comment Share on other sites More sharing options...
AzeoTech Posted August 25, 2016 Share Posted August 25, 2016 That depends. Is 3D what appears in the monitor as a hex value, or is it an ASCII representation of the letters "3" and "D" which corresponds to the hex value 3D? If the first, then there is no conversion. Hex and decimal are just two different ways of representing the same number. If the second and its a string with 2 characters, then you can use evaluate with "0x" prepended: evaluate("0x" + hexstring) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.