06-19-2025 09:20 AM
Hi,
I would like to extract 040C from my frame and convert it to decimal. Currently, I’m able to extract it from the frame, but I can’t convert it to decimal. I tried using 'Hexadecimal String To Number', but without success.
DATA : 0112 080F 0000 1B58 0200 0004 0C02 0100 0100 00D0 3E
Does anyone have an idea, please?
Solved! Go to Solution.
06-19-2025 10:41 AM
Try this:
06-19-2025 10:44 AM
forgot to attach the vi, here it is
06-19-2025 10:48 AM
for string controls you can view bytes as nonsense, byte strings, passwords? or Hex by right clicking the string control and selecting an option (see below).
06-19-2025 11:01 AM
@Jay14159265 wrote:
for string controls you can view bytes as nonsense, byte strings, passwords? or Hex by right clicking the string control and selecting an option (see below).
Which is why you should make the display type visible if it isn't the default display type.
06-19-2025 11:49 AM
@billko wrote:
@Jay14159265 wrote:
for string controls you can view bytes as nonsense, byte strings, passwords? or Hex by right clicking the string control and selecting an option (see below).
Which is why you should make the display type visible if it isn't the default display type.
Yes ... if you look very closely you can see the "n" for nonsense ; )
06-19-2025 12:14 PM
Hi and thank you for your answers
I would like to extract 040C from my frame and convert it to decimal (040C = 1036). Your script extracts 4C from the frame (4C = 76). Maybe I didn’t express myself clearly.
06-19-2025 12:28 PM
@Fredo123Danzel wrote:
Hi and thank you for your answers
I would like to extract 040C from my frame and convert it to decimal (040C = 1036). Your script extracts 4C from the frame (4C = 76). Maybe I didn’t express myself clearly.
I think you are missing a byte of data.
06-19-2025 12:29 PM
When I enter 040C as a constant, I’m able to convert it to decimal (040C = 1036):
but when I extract 040C from my frame (0112 080F 0000 1B58 0200 0004 0C02 0100 0100 00D0 3E), I don’t get the correct conversion (I get 0).
06-19-2025 12:34 PM - edited 06-19-2025 12:49 PM
@Fredo123Danzel wrote:
I would like to extract 040C from my frame and convert it to decimal (040C = 1036). Your script extracts 4C from the frame (4C = 76). Maybe I didn’t express myself clearly.
You have a binate string and this has nothing to do with hex formatting.
You need to typecast or unflatten it to your required datatype (U16 or I16). You get 1036 if you assume big endian.