DOUBT:UART SERIAL RECEIVE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 3:49 AM
I'm trying to Receive a message "hello" from serial monitor and viewing it on Live expression,but message is not coming as word. It is coming as single letter- H E L L O.
char msg[20]="hello\r";
HAL_UART_Receive(&huart2,msg,sizeof(msg),1000);
i am using this code.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 4:50 AM - edited ‎2023-09-29 5:43 AM
Hello @Arjun_Bansal
This is normal because you are sending an array of char and you are going to receive an array of char (every char take a byte of this array). Use UART_transmit to review it on the same serial monitor and you will see the full string.
Best regards.
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 4:50 AM - edited ‎2023-09-29 5:43 AM
Hello @Arjun_Bansal
This is normal because you are sending an array of char and you are going to receive an array of char (every char take a byte of this array). Use UART_transmit to review it on the same serial monitor and you will see the full string.
Best regards.
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 5:39 AM
Hello @Arjun_Bansal and welcome to STCommunity :),
I advise you to take a look to these wikis:
These articles explain what is UART and how to use it through examples
I hope this help you.
Kaouthar
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 5:39 AM
"DDD" corresponds to what is in msg, so no issue there. No reason the code you posted can't work.
Show your actual code in the place it's being used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 9:56 PM
I'm just getting started with it. Please let me know how to receive a string from serial monitor and see it as string on live expression. I MEAN HOW TO DECLARE A STRING.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-29 10:21 PM - edited ‎2023-09-30 7:13 AM
To receive a string, you are doing exactly what you have to do. The reception will stay in this form. To understand more, take a look at this video.
Strings are declared as an array of char.
Best regards.
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-30 6:49 AM
> You can declare a string directly like this:
> String a;
Huh? Maybe time to recalibrate the AI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-30 7:12 AM
No, no is just a typo not an AI Error. Thank you for your feedback.
Best regards.
II
