Ratataplam Posted July 19, 2019 Report Share Posted July 19, 2019 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 ? Quote Link to comment
Jordan Kuehn Posted July 19, 2019 Report Share Posted July 19, 2019 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. Quote Link to comment
infinitenothing Posted July 19, 2019 Report Share Posted July 19, 2019 Just scale it Quote Link to comment
jacobson Posted July 19, 2019 Report Share Posted July 19, 2019 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. Quote Link to comment
Ratataplam Posted July 22, 2019 Author Report Share Posted July 22, 2019 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 Quote Link to comment
jacobson Posted July 22, 2019 Report Share Posted July 22, 2019 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. Quote Link to comment
infinitenothing Posted July 22, 2019 Report Share Posted July 22, 2019 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. Quote Link to comment
Ratataplam Posted July 23, 2019 Author Report Share Posted July 23, 2019 Thanks Infinitenothing Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.