Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

UART Terminating character

Status
Not open for further replies.

pradhr

New Member
Hi,

I couldn't clearly understand, which terminating character require to send while using UART in microcontroller?
If we are communicating between "microcontroller<-->PC". As per I know, the terminal program used on PC is set to use some short of terminating character for in coming stream.
But what if we are communicating between two microcontrollers? or between two UART ports of the same microcontroller? How can we know which terminating character we require to send?
Because some time it works with \r\n, sometime only \r and some time only \n ?

Please somebody clarify this concept...

Thanks in Advance.
 
Those are a mere PC use. You can use what ever you want. Since your coding it. I can create my own terminal in C# for windows and use ~ as my terminating character. Its all customizable. Just use what you want and in code check for it.
 
What Atomsoft stated is correct and I two use the "~" as it's not a popular character for me in the ASCII table.

The \r and \n or CR and LF are characters that tell the receiving terminal where to move the cursor. \r=return says move (return) the cursor to the beginning of the line, the \n=new_line advances the cursor to the next line. The \r + \n would return to the beginning of the line and drop to the next line for a fresh line to display characters on.
 
Last edited:
If you want to be able to use all characters you can use byte stuffing. You use a special character (for example '~') to indicate the next byte has a special meaning, but if you send the special character twice '~~' it's seen as a databyte '~'.
 
Status
Not open for further replies.

Latest threads

Back
Top