LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

singed integer from hex string to number converter

Solved!
Go to solution

HI guys....

I want to convert the number from hex string to number converter but when i am connecting integer to default it is not changing the value (like if you write "EC78" you should get "-5000" but i am getting value in range of 60 thousend)...

Any ideas????

Thanks in advance.....

Niladri...

0 Kudos
Message 1 of 5
(3,122 Views)

Hey Newbee,

 

If you're expecting -5000 from a EC78 hex. value, then you're expecting the convert the string into a complemented U16 :

- "EC78" = 60536 so the complement U16 would be 65535 - 60536 = 4999

 

The you just have to take the opposite number 😉

 

Str2U16.png

 

Hoping this was it.

Regards,

Eric

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

0 Kudos
Message 2 of 5
(3,115 Views)
Solution
Accepted by topic author Newbee_3

Hi Eric,

 

the OP clearly asked for signed integers!

 

Use that approach:

check.png,

it will result in "-5000" for your EC78h example...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(3,110 Views)

Just to expand on what others have said.  Use the Hex String to Number.  The key is that the representation you use for the "default" terminal will dertermine the representation of the output.  So if you wire in an I16 into the default, you will get an I16 out and you should get the results you are looking for.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(3,099 Views)

Thanks everybody for their reply but I think I will use Mr.. GerdW method, as it is much simpler

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