Python Forum
Problem to sent message with pyserial and ser.write
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem to sent message with pyserial and ser.write
#11
message = f'{message}\n'
ser.write(message.encode('ascii')
f-string require python 3.6 or newer
alternative:
message = '{}\n'.format(message)
Reply
#12
Thank you Larz60+ :)

Is it possible to have the equivalent of the following line in python please ?

ReadInterval=2147483647, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=1100, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
Reply
#13
Are you asking how to add CRLF to these?
if so use same method as with message
example:
ReadInterval = '{}\n'.format(2147483647)
Reply
#14
Sorry, english is not my native language.
I need to improve the communication of the script to the serial port.
The display is very capricious on receiving the data.
The display captures only 1 word. If I send 10 words for example, it blocks and displays nothing.
I should be able to regulate the speed of sending the order or something like that.

The sniper give me this value when I send the orders :
  • XonLimit = 32768
    XoffLimit = 8192
    ReadInterval = 0, sometimes 2147483647
    ReadTotalTimeoutMultiplier = 0
    ReadTotalTimeoutConstant = 1100
    WriteTotalTimeoutMultiplier = 0
    WriteTotalTimeoutConstant = 0

Is it possible to import its values into pyserial, and if so how?
Reply
#15
I read in the pyserial documentation that XonXoff can have the value: True or False.
It is not possible to have?
Xon = 32768
Xoff = 8192

With cutecom, everything works perfectly.
It's why I think I have problem with RS232 communication in my python script.
Reply
#16
Xon, Xoff is (usually, and hopefully with this package as well ) serial flow control and stands for pause transmission and resume transmission so would be a Boolean value.
Reply
#17
Thank you for your help Larz60+ :)
YES, I think you are rigth !
Do you have any idea how I can improve my code?
Reply
#18
Don't have time to look at it now, perhaps later
Reply
#19
Thank you Larz60+, I will try to continue my research :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  write to csv file problem jacksfrustration 11 1,367 Nov-09-2023, 01:56 PM
Last Post: deanhystad
  little problem with read out and write into a file hello_its_me 11 8,423 Sep-04-2017, 11:54 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020