This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I cannot print the error value correctly in the LCD received from the motor controller using the UART protocol.

I am writing a code to receive the UART protocol transmitted from the motor controller and I am decoding the accepted protocol as speed, voltage and error using arrays. The received protocol is in continuous mode so, I captured them in another buffer to keep them constant. When I am receiving an error, suppose when error = 11, I am getting 10 or 00 like that. How to get the correct value. Here are some references.

Help me in completing this.

 This is the code I wrote.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0