5

There is something I don't understand about serial monitor.

As far as I know the Newline option is \n.

The Carriage return option is \r\n.

But does that make the Both NL & CR option \n\r\n?

asked Apr 7, 2016 at 16:11

2 Answers 2

8

Newline is \n

Carriage Return is \r

Both NL & CR is \r\n

answered Apr 7, 2016 at 16:31
1
  • It would be wonderful if this could be called "CR & NL" (note the sequence) or maybe just say \r\n. Because when you read "Both NL & CR" you then scratch your head and say "hm, does this actually mean \n\r". Commented Feb 18, 2023 at 0:47
3

"Both" means 1 Carriage Return and 1 Newline (formerly known as "Line Feed"). Our present day "standards" are descended from mechanical teletypes that used those separate codes for the two separate mechanical functions: Returning the print carriage to the left side of the page, and scrolling the paper up one line.

The DOS/Windows world adopted the teletype standard (both) as is.

The unix world dropped the carriage return as unnecessary, letting a single character stand for the end of a line, and more modern hardware (or its software drivers) could figure out what to do for the particular device.

The Apple world chose Carriage Return for its standard back in the mists of time, dropping it in later years for a selectable end-of-line sequence where appropriate, but more usually using the unix standard once it's OSes became hosted on unix.

answered Apr 7, 2016 at 17:14
1
  • Baudot had separate CR LF. It was common to use CR and duplicate part of a line to get "Bold" characters. Commented Apr 8, 2016 at 1:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.