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.
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.
01-10-2012 09:36 AM - edited 01-10-2012 09:41 AM
Hello,
How can I transfer two values, one FxP and one timer value, from the fpga to the RT host simultaneously so I know which timer value corresponds to which FxP value on the RT host. With DMA FIFO it is not possible to select "custom control" as the data type.
Thanks in advance,
Dries
Solved! Go to Solution.
01-10-2012 10:18 AM
Simpliest way is to interleave the data.
http://zone.ni.com/reference/en-XX/help/371599G-01/lvfpgaconcepts/fpga_dma_fifo_interleave/
There are some limitations, like both data elements need to be the same type and you'll need to make sure you don't get off by one when reading the elements.
Otherwise you'll need 2 separate FIFOs for the data and timestamp and syncronize the write/reads.
01-11-2012 02:01 AM - edited 01-11-2012 02:02 AM
The data elements are not the same type (FxP & int32). Any ideas how I can sync the write/reads?
01-11-2012 05:09 AM - edited 01-11-2012 05:10 AM
Hello Dries,
How many bits does your fixed point number need?
Another solution could be to convert the fixed point value to an int32, interleave it with the original int32 values and then convert it back on the other side.
Would this be an option?
01-11-2012 07:44 AM
Yes that seems like a good idea. The fixed point nr is <+- 24,15>. I can typecast it to U32 and back.
Thank you all for the quick replies !
01-12-2012 09:57 AM
Hello Dries,
If any questions would arise, then don't hesitate to let us know.
01-13-2012 02:37 AM
I'm having a problem converting the u32 number back in the original FxP number.
For example: I convert the FxP number 16,785 <+-,24,15> to an u32 with "number to boolean array" and "boolean array to number" to 8594. When I typecast it back on the FPGA, I get the original FxP number. But when I typecast it on the RT device, I get a different value; 0,0644531
In both devices, I'm using the same type (<+-,24,15>) to cast the number to the FxP. How can I get the correct value on the RT?
01-13-2012 02:55 AM - edited 01-13-2012 02:56 AM
Found the answer already. On the RT host, I have to cast the U32 number to <+-,32, 23> instead of <+-,24,15> because the U32 number is 32 bits large ofcourse. When casting it to <+-,24,15> the number gets rolled over so I get a wrong value.
01-13-2012 03:11 AM
New problem! 🙂
Previous solution only works for positive fixed-point numbers. Negative numbers are converted to a large positive number. How can I get this to work for all the numbers in range?
01-13-2012 04:17 AM
Hello Dries,
There are 2 interesting conversion function that can be used in LabVIEW and in LabVIEW FPGA.
These would simplify the code even further:
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/integer_to_fxp_cast/
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/fxp_to_integer_cast/
This should do the trick.