12-05-2013 10:38 AM
Hi all,
I'm trying to implement a simple routine where I divide a FXP by the number 7 in FPGA. I wanted to use the high throughput division but it seems to only round to the nearest integer although the output is capable of representing fractions. Alternatively, I could multiply my number by 1/7 using the high throughput multiplication and I get what I want. I'm not too familiar with FXP arithmetic. Without fully understanding the problem, I at least have a solution which is to use the multiplication. I'd just like to know a little more. Can anyone please shine some insight on why the division rounds even though it can handle fractions?
Thanks for your help
Solved! Go to Solution.
12-05-2013 11:30 AM
Recreating your code on my machine, I got an appropriate fractional answer for the division (15.7109). I wonder if the configuration of your HTM node and/or the representation of your controls/indicators is set to something different? Can you attach a simple VI that demonstrates the problem? Here's my VI (saved in LabVIEW 2013) that works fine. I don't think it matters, but I'm running this VI in emulation mode under a cRIO-9074 target.
12-05-2013 11:47 AM
Either of these options should work assuming your value for "1/7" is sufficiently precise for the output type you need. The divide is configured with a less precise output than the multiply, if you change the output of both to match do you get the same (or closer) answer?
12-05-2013 02:09 PM - edited 12-05-2013 02:10 PM
Thanks for the suggestions. I recreated this and indeed was able to get the correct results! So what happened?
This may blow your minds, but there is something inherently wrong with my x/y indicator. I have it on "adapt to source". I created another supposedly identical indicator ("x/y 2") off the same wire and get the correct result with that indicator. This seems like some kind of bug but it worries me because I should have never run into it.
I've attached a screenshot of the code in action as well as the VI (i'm using 2011)
Thanks
12-05-2013 02:17 PM
Somehow your original indicator got set to have 0 digits of precision for display formatting. This means the data is actually correct and there, but the textual format of the display to the screen rounds to integer.
Any ideas how that setting got changed?
12-05-2013 03:11 PM
Thanks, so the adapt to source doesn't actually change my display format.
Got it!