2020-09-30 01:03 AM
My code is below,
uint16_t val;
float voltage=0;
while
{
HAL_Delay(1000);
/* USER CODE END WHILE */
HAL_ADC_Start(&hadc);
HAL_ADC_PollForConversion(&hadc, 10);
val = HAL_ADC_GetValue(&hadc);
voltage= ((val/4096)*3.3);
sprintf(p,"%1.3f ",voltage); /* For floting value displaying*/
HAL_UART_Transmit(&huart2, p, sizeof(p), 10);
HAL_ADC_Stop(&hadc);
}
but when I sent the integer value its work proprly like, please refer below code
while
{
HAL_Delay(1000);
/* USER CODE END WHILE */
HAL_ADC_Start(&hadc);
HAL_ADC_PollForConversion(&hadc, 10);
val = HAL_ADC_GetValue(&hadc);
sprintf(p, "%d ", val);
HAL_UART_Transmit(&huart2, p, sizeof(p), 10);
HAL_ADC_Stop(&hadc);
}
I have set the linker -u _printf_float in command and -mfloat-abi=soft in Compiler
but not got success yet. please
2020-09-30 03:51 PM
I don't think "Additional object files" is the appropriate place for those options. STM32CubeIDE has a checkbox to enable these in "MCU Settings".
2020-09-30 07:35 PM
project->properities->C/C++build->Settings->MCU settings->use float......
This is my steps to use "printf float"
2020-09-30 10:36 PM
I am using Atollic true studio,
2020-09-30 10:58 PM
not able to find -mfloat-abi=soft settings in atollic true studio
2020-09-30 11:00 PM
required settings in atollic true studio.