2022-12-13 05:31 AM
I use this code to get the data ADC and transmit it but I can't see my data on Tera Term, I see my data in live Expression but not in Tera Term so most probably problem comes from Transmit part!! I would be happy if you take a look at the code that which part might be wrong.(STMG01291)
ADC1 - IN9 (tick)
Parameter Settings --> ADC Settings --> Continuous Conversion Mode (Enabled)
Enable USART1 asynchronous
Parameter Settings --> Basic Parameters --> Baud rate 9600
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_ADC1_Init(void);
static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint16_t readValue;
char string[10];
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
HAL_ADC_Start(&hadc1);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_ADC_PollForConversion(&hadc1,1000);
readValue = HAL_ADC_GetValue(&hadc1);
HAL_UART_Transmit(&huart1, (uint8_t *)&readValue, sizeof(readValue), 100);
2022-12-13 06:19 AM
2022-12-13 06:48 AM
Duplicated questions with:
BR
Romain
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.