Page 1 of 1

Carriage return

Posted: Fri Feb 13, 2009 12:45 pm
by spence
Hi

I am sendind data to a coms ports "letmein" how do I add a carriage return to this ?

Thanks
Spence

Re: Carriage return

Posted: Fri Feb 13, 2009 3:52 pm
by Benj
Hello

Carrage returns and line feeds are legacy items left over from the days of early dot matrix printers. The ascii values would cause the printers to move to the start of the line (carrage return) and also move to the next line (line feed). The ascii values for a carrage returna and line feed are like any other ascii value eg the ones im using to write this text. For example the ascii value for a '0' character is 48. You can test this by holding alt and typing 48 on your numeric keypad.

To send a carrage return send the number value 13.
To send a line feed send the number value 10.

So for a enter character as you would get off your keyboard you will have to send two bytes with the values 13 and 10, or 10 and 13 dont think the order you send them will effect anything.

For a full list of Ascii characters please see this website.
http://www.asciitable.com/