Hello,
I'm not certain if K20 has a floating coprocessor .
I've the following line in the code:
ad_result2_word=(float)DAC2_prev*((float)result_1/(float)result_2);
where:
ad_result2_word,DAC2_prev are uint32_t and result_1,result_2 are uint16_t
when I single step through the code I can verify the result as correct however when I let it run for awhile and stop it the result are bogus values.
I'm using KDS for the project .
I'M NOT SURE IF I'M DOING THIS MULTIPICATION CORRECTLY OR IF KDS IS USING SOME FLOATING LIBRARY OR EVEN IF K20 HAS A FPU.
Any ideas?
Thanks,
Koorosh Hajiani
248-778-6396
in addition, only the part number with "F" has floating point module. for example K22F can support FP but K20 can't.
with K22F, we can set floating support as
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
BUT 'ideally' the library-routines and the hardware would *ALWAYS* return the same values, the only DIFFERENCE should be the execution time + code size for the library (and of course the actual instruction stream, which you should look at to SEE the 'float' instructions to 'know what you get'). That is to say, you should look elsewhere for 'bogus values' coming out.