Serial Communication With Printer

Hello everyone. I have a Bixolon(Samsung) receipt printer connected to Serial port 1 (ttyS0). I need to send it commands I got this far

echo 'Hello World' > /dev/ttyS0

Now I need to send it commands in the manual it gives a list of commands and whenever I put

echo RT > /dev/ttys)

It just prints RT without doing the command. The manual alludes to the existence of an escape character; however, I don’t know what that is or how to enter it in if it is not a printable character.

I know this is not the Bixolon support pages, they don’t have them. However, there are some smart people in this forum that may have dealt with this before. Yes this is on an OpenSUSE 11 computer so I at least have the OS right. Any help is greatly appreciated.

I can’t help you with the printer command sequences, I know nothing about the printer, but to escape arbitrary characters using the echo command, use the -n and -e options. -n suppresses the newline at the end, and -e enables sequences to send arbitrary characters. Thus to send ESC Z for example, do:

echo -n -e '\0033Z' > /dev/ttyS0

ESC is 0033 in octal. See man echo for details.

Thanks for your help. I think I somewhat get it as I can now mess up the printer’s output. Can I get an example of how one of these would look. Here is the code for line feed.

ASCII: LF
HEX: 09
Dec: 9

They don’t give the Octals. What would the code be to send a simple line feed?

If you look at the man page for ascii, using the command

man ascii

you can get a table of characters and their values in octal.

Thanks for all the help it pointed me in the right direction. When it came right down to it, it was simply

echo -e -n '\x##\x##\x##...'