pyserial - escape codes transportation
Grant Edwards
invalid at invalid.invalid
Fri Dec 11 14:56:23 EST 2009
On 2009-12-11, ObservantP <johnkduffy at gmail.com> wrote:
> need help. newbie. pyserial and dot matrix printer.
> issue- escape codes arrive at printer ( verified from hex dump) but do
> not get applied.
What you're saying is your printer isn't working correctly.
> printer make/model STAR POS printer SP500. oddly, printer
> commands not initiated with the escape code .i.e. a symbol,
> work fine.
>
>
> import serial
> ser=serial.Serial(0)
>
> ser.bytesize=7
> ser.timeout=1
> ser.dsrdtr=1
> ser.write('PySerial'+'\n')
> ser.write('Star SP500'+'\n')
>
>
>
> #Double Width On 14 SO = Or ESC W 1 / 0
> # Off 20 DC4=
>
> ser.write('' +'Double Width-Symbol\n') #Good
> ser.write('' +'Reset\n') #Good
> ser.write('\n') #Good
>
> ser.write('Xw1\n'+'Double Width-ESC\n') #Nope ( Nor CHR(027)
FWIW, that's _not_ sending an ASCII escape character. It's
sending a string starting with a caret and a square bracket.
I don't know what you're actually trying to send, but my guess
is that you want is '\033w1' or '\x1Bw1'
--
Grant Edwards grante Yow! I'm also against
at BODY-SURFING!!
visi.com
More information about the Python-list
mailing list