cancel
Showing results for 
Search instead for 
Did you mean: 

UART WITH STM32L476

ACekm.1
Associate II

i was planning to do an experiment i need to insert two numbers and calculate the sum of that two inserted number. Then i need to see them in terminal. However i have confused a bit. Could anyone help me? I get stuck over here.

 /* USER CODE END 2 */

 int First_Digit;

 int Second_Digit;

 int Sum_Digits;

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

   /* USER CODE END WHILE */

uint8_t First_Digit[] = "first digit \r\n"; // data to send

HAL_UART_Transmit(&huart2, First_Digit, 18, 100);

HAL_Delay(2000);

uint8_t Second_Digit[] = "second digit \r\n"; // data to send

HAL_UART_Transmit(&huart2, Second_Digit, 18, 100);

HAL_Delay(2000);

uint8_t Sum_Digits[] = "sum \r\n"; // data to send

HAL_UART_Transmit(&huart2, Sum_Digits, 12, 100);

HAL_Delay(2000);

   /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

}

11 REPLIES 11
S.Ma
Principal

Both methods cover 2 compromizes:

Best for reactivity and small ram usage

Best for low latency and minimizing interrupt occurence rate.

Thoughts?

thnx for answer but how can i perform to sum of two number with that this is the big problem for me. could u help me about it?