Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

can't output a right answer from divide function in sbRIO

Hi,

 

I'm using sbRIO 9636 to generate a sine wave with an amplitude of 1V. The divide function in my FPGA VI seems have some problem.

For example, if I divide 1 with 1, the answer is 1 when I chose integer output type. But when I chose single floating point output type, the answer is 1.07E9. I found this is 2^32, but don't know why and how to fix it.

 

Thanks,

Jiaqi

0 Kudos
Message 1 of 4
(5,361 Views)

I think the problem may due to the floating point calculation in FPGA.

If I do need floating point calculation in FPGA, can I add a time delay in the loop to guarantee that there's enough time to do this?

0 Kudos
Message 2 of 4
(5,338 Views)

Hi jwan887,

 

I haven't seen the same behavior myself on the FPGA, when simply testing all single floats and a divide function inside a while loop, with no other processing in the background on a similar sbRIO.

 

You shouldn't need to change the loop timing, as single floats aren't usable in single-cycle timed loops, and in a regular while loop the code should throw a compile error if the timing isn't met.

 

Could you post a screenshot of the relevant section of your code?  I'd like to see what else is going on that could cause this issue.

0 Kudos
Message 3 of 4
(5,327 Views)

It may also be useful to list the versions of your software you notice this in.

Tannerite
National Instruments
0 Kudos
Message 4 of 4
(5,323 Views)