TWR-K21F120M float Data types

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TWR-K21F120M float Data types

844 Views
黃佑煊
Contributor II

Dear sir, I have a TWR-K21F120M

But, when I want to use floating-point operations, there will be an error


temp.bmp

Thank you very much ~~

5 Replies

574 Views
ivadorazinova
NXP Employee
NXP Employee

Hello 佑煊 黃,


Please, check settings in KDS.

these documents could help you solve your problem:

Printing Floating point values to fsl_debug_console FRDM-K64F

and printf() with float values

I hope it helps,


Best Regards,

Iva

0 Kudos

574 Views
黃佑煊
Contributor II

Dear sir,

Sorry! I do not understand how to set this.

code.png

Thank you very much ~~

0 Kudos

574 Views
ivadorazinova
NXP Employee
NXP Employee

Dear 佑煊 黃,

Never mind. Please, try do it by this way:

Change std_prv.h to following:

#ifndef STD_FP_IO//DES added #ifndef
#define STD_FP_IO 0

#endif

and change the value in Preprocessor STD_FP_IO = 1

fpu.gif

Best Regards,

Iva

0 Kudos

574 Views
黃佑煊
Contributor II

Dear sir,

I can not find the preprocessor options

0 Kudos

574 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi 佑煊,

Do you use CW10.6 ?

In you screenshot , where show the float error ?

And about the float configuration on CodeWarrior, you can select on here :

pastedImage_0.png

And i have test on my side (mk21fn1m0 - CW10.6), when define like your code (float tt; tt = 2.0f),  it can work well.

So could you show detail the float error .

Best Regards,

Alice

------------------------------------------------------------------------------------------

If this post answers your question, please click the Correct Answer button.

-----------------------------------------------------------------------------------

If this post help your question, please click the helpful Answer button.