10-10-2022 11:51 AM
Hello!
I have a question, when sending a data string from a microcontroller to Labview,
is it better to send a line break at the beginning of the data string and send a
carriage return at the end? Or is it better to send the carriage return first and
the line feed last? The data will be read by VISA Serial in LabVIEW.
Best regards,
Mayra
10-10-2022 11:59 AM - edited 10-10-2022 12:00 PM
Hi Marya,
send just a LF at the end of your message…
10-10-2022 12:43 PM
Many devices will send a Carriage Return and a Line Feed (in that order). Many others just send a Line Feed. Occasionally, I'll run into an instrument that only sends a Carriage Return. But I recommend just sending the Line Feed at the end of the message. Then you can use that as the Termination Character and VISA will take care of quite a bit for you. Watch the video Gerd linked to and things should be more clear.
10-10-2022 02:11 PM
Generally, CR precedes LF. This is a remnant from the days of electromechanical user interface devices. The earliest one I remember is the TeleType model ASR-33. It ran at 110 baud (10 chrs/sec).
CR moved the print head back to home (all the way to the left), LF advanced the paper up one line. They were separate functions because sometimes you wanted to do one without the other.
They had to come in the order CR then LF because if the carriage is far to the right, it takes more than 1/10 second to return; thus the chr. after the CR gets executed while the carriage if slamming to the left. If that chr. is an LF, no problem; but you wouldn't want a printable chr. to come right after a CR because it would get printed somewhere in the middle of the paper instead of at the far left.