Skip to main content
carlo92-ct
Associate
October 5, 2015
Question

Send ADC measurement to PC through USART

  • October 5, 2015
  • 2 replies
  • 850 views
Posted on October 05, 2015 at 19:42

Hello,

my name is Carlo. I'm a student new to STM32 and MCUs in general.

What I'm trying to do is to send a 16-bit ADC value through USART to PC, using stm32f0. I found some troubles doing this since USART takes one byte each time whilst ADC1ConvertedValue is 16-bit.

I've tried to split a 16-bit value into two bytes but i don't know how to rejoin them to show the actual 16-bit result in the PC.

Does anyone have any suggestions ?

Thank you very much in advance.

Regards,

Carlo.

#adc #usart #stm32f0
This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
October 5, 2015
Posted on October 05, 2015 at 20:07

So further presuming little/no PC or C programing experience.

Why then not just output the values in ASCII, with sprintf(), or itoa() type functions, and sending the string of bytes to the PC Terminal application in a human readable form?

{

   char String[16];

   sprintf(String, ''%d\n'', ADCValue);

   USART_SendString(USARTX, String);

}

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
carlo92-ct
Associate
October 6, 2015
Posted on October 06, 2015 at 11:47

Thank you very much Clive1. Your help has been really useful !