LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

join numeric with join numbers function

Solved!
Go to solution

Hi !  a small question from a guy that didnt use labview for a while !

i need to use the join number function to join two DBL number A and B to form a new number A.B, just like the join numbers function

in the example i would like the results after the join number function to be 1.5 

 

however i understand that the function merge bytes/words together and the result is far from what i expect ....  any ways to 

 

A and B are extracted from modbus READ register command and are unsigned 16 bit

 

seems easy enough but i need a good refreshment on how those bits, bytes and numeric works together..   doh !

 

thank for everyone involved, Kudos to all labview champions!

Download All
0 Kudos
Message 1 of 23
(7,362 Views)

Hi yan,

 

it seems you really need a refreshment on all those bits/bytes/numeric representations 😄

 

Typecasting floats (DBL) to U16 will probably never result in the desired value.

Why do you convert your U16 modbus values to DBL anyway? Stick with U16 and you will have no problems using JOIN or any other bit-banging function...

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 23
(7,355 Views)

then why do i get 65541 as the result?

0 Kudos
Message 3 of 23
(7,342 Views)

Hi yan,

 

because 1*2^16+5=65541.

 

Which result do you expect?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 23
(7,335 Views)

You mean 1 and 5 should give you 15?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 23
(7,330 Views)

Hi yan,

 

if Anands idea might be your goal you should use some simple math instead: 1 * 10 + 5

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 23
(7,327 Views)

thats why i need the end results to be in DBL, caus i want 1.5 as the results

not 15

0 Kudos
Message 7 of 23
(7,316 Views)

Hi yan,

 

so the simple math changes to a + b/10 with a=1 and b=5. Where's the problem?

 

The problem seems so simple, but you can not provide any good information/description of your logic/task. What does the manual of your device say about those numbers?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 23
(7,313 Views)

the two register i am reading from the modbus device gives me a ppm values of a gas detection system

A being before the comma

B being after the comma

in the format A.B ppm

to log the values red by the system i need to combine them together before and then log them, display them in a graphic..etc

0 Kudos
Message 9 of 23
(7,311 Views)
Solution
Accepted by topic author yandub666

Hi yan,

 

as your description still isn't clear in all details I provide two options, see which one fits your needs:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 23
(7,306 Views)