LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Single Data Type to 4 byte (U8) array in FPGA

Solved!
Go to solution

I need to convert a single precision float value to a four byte U8 array in the FPGA to transmit using UART code that I've already generated also running on the FPGA.  There are reasons why I need to perform this operation in the FPGA and not on the host side, which I will not go into here.  I'm struggling to find solutions that don't include using string functionality, which obviously is not available to me on the FPGA side.  Thanks very much in advance for any suggestions.

0 Kudos
Message 1 of 8
(574 Views)

Hi Sean,

 

I'm trying to do something similar to your solution, but without converting to ASCII.  I will have a single float value ranging from -0.5 to +0.5.  I would like to maintain 4 digits for the decimal/fraction, so 0.XXXX.  I want to convert it to an array of four U8s (or it could be eight U8s).  Can you help with what mods I would make to your VI to accomplish this?

 

Thanks much.

 

JJ

0 Kudos
Message 2 of 8
(578 Views)
Solution
Accepted by topic author johnsoja
0 Kudos
Message 3 of 8
(566 Views)

Hi Raphael,

 

Thank you very much for the prompt response and that approach does look like what I need.  However, when I attempted to open the .vi, I get the error "Support file regeneration required".  I attempted to perform the regeneration, but that fails.  See error screenshots below.  Can you advise on how to correct these issues?

johnsoja_0-1723038800523.png

 

johnsoja_1-1723038827014.png

 

Thanks again.

JJ

0 Kudos
Message 4 of 8
(501 Views)

Edit: Oops solution is already there. My bad. Ignore what I added.


Hi John,

 

If you are okay with eight U8s and some precision loss, I tried something that might work for you.

Getting Fractional and Integer Values from SGL.png

 

Xonmyth_0-1723048778084.png


Hope this gives you some ideas.

0 Kudos
Message 5 of 8
(461 Views)

This issue is closed based on Raphael's solution located at : https://forums.ni.com/t5/LabVIEW/Flatten-floating-point-on-FPGA-for-multichannel-DMA/m-p/2576179#M77....

 

I had trouble regenerating the IP Integration node on my PXI chassis due to the often mentioned incompatibility between Windows 10 and ISE 14.7 and Vivado.  I was able to perform the regeneration on another Windows 7 machine and all is working.  

 

Thanks again to Raphael for the help!

Message 6 of 8
(459 Views)

Please kudo this idea to add support for bit reinterpretation (type cast) in FPGA.

0 Kudos
Message 7 of 8
(414 Views)

Done

0 Kudos
Message 8 of 8
(408 Views)