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