Carriage return

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

Post Reply
spence
Posts: 11
Joined: Wed Dec 10, 2008 7:42 pm
Contact:

Carriage return

Post by spence »

Hi

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

Thanks
Spence

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Carriage return

Post 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/

Post Reply