2014-06-09 03:53 AM
Hi, I can't stand why my stm32f4 does not do the floating point calculation.
Frequency = (RCC_Clocks.HCLK_Frequency)/2 / (IC2Value * (TIM4->PSC+1));Frequency is a float variable, but when i read it with ''printf'' there's an integer inside.2014-06-09 04:04 AM
Hi
Basic (stupid) question : Are you telling printf to print a float number? printf( tmpString, ''%f'', floatVar )2014-06-09 05:07 AM
2014-06-09 06:39 AM
The printf is right. The problem was the IC2Value, now i've declared it ''float''. Thank you!
2014-06-10 02:31 AM
Hi,
Try this method for your old code,i.e declare IC2Value as you declared before. I think it will workFrequency =(float)((RCC_Clocks.HCLK_Frequency)/2 / (IC2Value * (TIM4->PSC+1)));