Jump to content

UINT16 to FXP


Recommended Posts

Posted

Hi all,

 

i try to generate a sinewave in FPGA (NI cRIO Platform), to do that I use the specific VI (Sine Wave Generator) for fpga  to produce a sinewave in UINT16 data type.

Unfortunatelly my AO module works with FXP data type  (see attach) and I need to adaptd the UINT16 to AO module.

A simple cast is not sufficent because I loss information, any suggestion ?

FXP.JPG

Posted

I believe if your word length is 16 bits and the integer word length is also 16 bits and mark unsigned you will have a FXP data type that will contain the UINT16 properly. 

Posted

What c-series module are you using? In the project, if you right-click the module under the FPGA target, some have the option to change their I/O between calibrated and raw. In this case raw would probably be much easier to work with.

Posted

Thanks at all, both solution works.

My question is an academic question. If I connect the sine wave generator to AO port or to Multiply operator a "cast" (red dot) is used by LV. Now, I must certificated my project and the assessor could be ask something about the red dot so how I can demonstrate that I don't not loss the information ? One solution is the test as decribed by "infinitenothing" or logical approach as suggest by Jordan. Does exist the way to avoid the cast without change the HW settings?

 

Regards

 

Posted

The red dot just indicates that LabVIEW will be coercing the data for you so whether there is a loss of information depends on what the data is being coerced from and to. For instance, if a U8 is being coerced into a U16 there isn't any loss of data but if we instead coerce the U16 into a U8 we are losing the top 8 bits of data (depending on what we know about this data this may or may not be an issue for us). FXP conversion will likely lose information because LabVIEW tries to preserver the value rather than keeping the bit value and changing the interpretation of those bits.

If you attach the project you are working out of we should be able help explain what would happen for your particular case. 

Posted

If the red dot is scary, you can just drop in a "to fixed point" in there. It explains the conversion (rounding mode and overflow mode) a bit better. In this case, the output is exactly the same as the input in the same way that 16 is the same as 16.0.

 

to fixed point.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.