pyserial icon indicating copy to clipboard operation
pyserial copied to clipboard

Issue with pyserial using same settings as a serial com program

Open sylphrena0 opened this issue 4 years ago • 1 comments

I hope you all can help me with this. I am trying to switch from a serial communications program to a python script for controlling some ASCII serial displays (Vorne M1000 120). As far as I can see it, the configurations are identical and I see no errors, but my code does not work and the program does. Hopefully you all have some ideas:

Python code:

import serial

ser = serial.Serial()
ser.baudrate = 19200
ser.port = 'COM2'
ser.timeout = None

print(ser)

ser.open()
ser.write(b'<ESC>01A<ESC>5F<ESC>8;0SThis<SP>display<SP>is<SP>working!<SP><SP><SP><SP><SP>Good<SP>Morning!<SP><SP><SP><SP><SP><CR>')
ser.close()

The program (Vorne Serial97) config: image

Here is the manual for the display, with explanations of command structure.

sylphrena0 avatar Jul 29 '21 14:07 sylphrena0

Check out the table "control characters" on page 13 in the manual. Seems the stuff in angle bracket represents just one ASCII character, so e.g. for <ESC> you would use \x1b instead (which is the way to write a character in hex in python strings).

zsquareplusc avatar Jul 30 '21 23:07 zsquareplusc