Ana sayfa Forumlar Gömülü Sistemler STM32 Uart communication float number sending problem

1 yanıt dizini görüntüleniyor
  • Yazar
    • #1577 Yanıtla
      Anahtar yönetici

      While working with StmCubeIDE, I use the following lines of code to print the float element to the screen with uart. The strings are written to the Termite screen, but the floats are not written to the screen

      HAL_UART_Transmit(&huart3,Data,sprintf(Data,"Pressure: %4.2f Pa \t Temperature: %4.2f C \t Altitude: %4.2f m",pressure,temperature,altitude),HAL_MAX_DELAY);

    • #1578 Yanıtla
      Anahtar yönetici

      I solved my problem.
      1- Left click on your project file from StmCubeIDE application
      2- Go to Properties
      3- Go to the C/C++ Build tab on the screen that opens
      4- Click on Setting option
      5-Open MCU GCC Linker option in Tool Settings
      6- Add this code -u_printf_float to the Command section
      7- Apply and Close
      That’s all, now reload the code and open in Termite screen

      • Bu yanıt 4 ay 2 hafta önce önce Mustafa ErgülMustafa Ergül tarafından değiştirildi.
1 yanıt dizini görüntüleniyor
Yanıtla: STM32 Uart communication float number sending problem