Skip to main content
BSing.4
Associate II
March 17, 2021
Question

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.

  • March 17, 2021
  • 4 replies
  • 1413 views

..

This topic has been closed for replies.

4 replies

waclawek.jan
Super User
March 17, 2021

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

JW

BSing.4
BSing.4Author
Associate II
March 18, 2021

Please send the one example of sending and receiving

Tesla DeLorean
Guru
March 18, 2021

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
BSing.4
BSing.4Author
Associate II
March 18, 2021

 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

Andrew Neil
Super User
March 18, 2021

"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 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.