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: 

data transfer fpga

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(2,637 Views)

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.


--Using LV8.2, 8.6, 2009, 2012--
0 Kudos
Message 2 of 10
(2,626 Views)

The data elements are not the same type (FxP & int32). Any ideas how I can sync the write/reads?

0 Kudos
Message 3 of 10
(2,618 Views)

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?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 10
(2,611 Views)

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 !

 

0 Kudos
Message 5 of 10
(2,601 Views)

Hello Dries,

 

If any questions would arise, then don't hesitate to let us know.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 6 of 10
(2,584 Views)

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?

 

0 Kudos
Message 7 of 10
(2,567 Views)

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. 

0 Kudos
Message 8 of 10
(2,565 Views)

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?

0 Kudos
Message 9 of 10
(2,562 Views)
Solution
Accepted by LVD

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.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 10 of 10
(2,558 Views)