From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decoding calculator

Solved!
Go to solution

Hi,

 

I am developing a Labview calculator to decode the HEX & Binary to decimal number by using below formula. 

Untitled.jpg

The decimal number I got is round to the middle of digital signal. It is possible to round the decimal number to ceiling and floor?

Thank you. 

Untitled.jpg

 

0 Kudos
Message 1 of 8
(2,829 Views)

Can you attach some LabVIEW code so we can understand how your question relates to LabVIEW?

 

I don't know what you mean by "round to the middle of a digital signal."

 

LabVIEW has several rounding functions that round down, round up, and round to nearest.

0 Kudos
Message 2 of 8
(2,828 Views)

I have an example:

U9.1.8

By entering the Integer and Fractional bits, my calculator is getting decimal number of 0.78125. However, if i am using others tool, the result is 0.77902.

1.jpg

Untitled.jpg

I am not sure can I get the exact decimal number or not. 

 

 

0 Kudos
Message 3 of 8
(2,809 Views)

Your latest post made things even less clear.  What is "U9.1.8"?  How does any of this relate to the digital signal you showed in the first post?

0 Kudos
Message 4 of 8
(2,804 Views)

U9.1.8

U = Unsigned

9 = Total bits

1 = Integer bits

8 = Fractional bits

The example shows decoding from the above format from HEX code (C8) to decimal number. 

I am thinking whether can decode the decimal number to nearest to ceiling / floor number. 

0 Kudos
Message 5 of 8
(2,802 Views)

Hi Juliana,

 

your result seems to be correct:

check.png

Or try this:

check.png(<+,9,1> is the LabVIEW term for a FXP of your U9.8 type.)

When you want to get the next possible values of your FXP numbers you need to count up/down your input value for one LSB…

 

However, if i am using others tool, the result is 0.77902.

Which other tools do you use?

How do they calculate their results?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(2,782 Views)

Hi GerdW,

 

Thanks for the reply.

Actually i also not too sure what tools they (other team) are using. 

May i know what tool that you are using to get 0.77902? 

 

Thanks.  

0 Kudos
Message 7 of 8
(2,774 Views)
Solution
Accepted by topic author JulianaLee

Hi Juliana,

 

Actually i also not too sure what tools they (other team) are using. 

Why don't you ask "them" - whoever that is?

 

May i know what tool that you are using to get 0.77902? 

As you can see from my images I get the same value of 0.78125 as you do.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(2,772 Views)