cancel
Showing results for 
Search instead for 
Did you mean: 

Decoding calculator

SOLVED
JulianaLee
Member
Solved!

Decoding calculator

Message contains an image

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

 

7 REPLIES 7
RavensFan
Knight of NI

Re: Decoding calculator

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.

JulianaLee
Member

Re: Decoding calculator

Message contains an image

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. 

 

 

RavensFan
Knight of NI

Re: Decoding calculator

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?

JulianaLee
Member

Re: Decoding calculator

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. 

GerdW
Knight of NI

Re: Decoding calculator

Message contains an image

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
JulianaLee
Member

Re: Decoding calculator

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.  

GerdW
Knight of NI
Solution

Re: Decoding calculator

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