cancel
Showing results for 
Search instead for 
Did you mean: 

I am working on STM32F103C8T6 with ADC and UART . I am getting the problem in send ADC value to UART ASCII Code and Problem in receiving from UART ASCII code to numerical value like 0 to 255. Please Help me.

BSing.4
Associate II
 
5 REPLIES 5

What have you done so far? Have you tried printf()/scanf() variants?

JW

BSing.4
Associate II

Please send the one example of sending and receiving

You'd send 16-bit values as two consecutive 8-bit values.

Or do you actually want to send as ASCII numeric values, ie 0-9 digits and as "12345" ​type string

Perhaps find some texts of numeric representation in micro-controllers.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
BSing.4
Associate II

 HAL_UART_Receive(&huart1,&HMI,1, 1);

if(HMI>215){ HAL_GPIO_WritePin(TRIACK_GPIO_Port, TRIACK_Pin, GPIO_PIN_SET); }

But this code is no work

"this code is no work"

You need to give more detail than that: http://www.catb.org/esr/faqs/smart-questions.html#code

  1. What did you expect it to do?
  2. What did it actually do?
  3. What testing / investigation / debugging have you done to find what's going wrong?

Don't try to solve multiple problems all at once: concentrate on just one at a time. So, before worrying about the ADC, have you got the serial comms fully debugged an working?

See: https://www.avrfreaks.net/comment/3104576#comment-3104576

And: https://www.avrfreaks.net/comment/1138166#comment-1138166

This is basic problem-solving stuff - not specific to microcontrollers or programming:

0693W000008xGoWQAU.jpg