We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello Everyone;
To send ASCII characters via USART I normally use Hal libraries and the function below;
HAL_UART_Transmit(&huart2, (uint_t*)"Hello", 6,10);
But, that one is for characters only. How can I send the value of an integer over USART as its ASCII characters ? Which functions and libraries should I use ? . . . For example (dummy program just to show my purpose):
int i = ADC read value; //Lets say i=15
printf(i); //value should be sent in ASCII characters, so 1 and then 5 should be sent in ASCII. . . .
Thanks for your help, Kind regards
Salih
Why are you waking-up a thread that has been dead for over 2 years?
You seem to be confusing the numerical values with ASCII character codes.
If you want to send the value 49 (ie, 0x31) as ASCII coded, human-readable text, then you need to send the character '4' followed by the character '9'
ie, in your example:
buffer [0] = '4'; buffer [1] = '9';