0

I am the begginer for python and rs-485. Currently I'm working on Modbus RTU protocol in RS-485, and I read and write data from read_holding_resister using python. Also, I need to control rs-485 relay using a python script. Thank you

Sample code

import serial
conn = serial.Serial(
port='/dev/ttyUSB0',
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1,
rtscts=False, 
dsrdtr=False)
while True:
   dataline = conn.readline();
   serialcmd = b'\x08';
   conn.write(serialcmd)
Murugesan
  • 43
  • 7
  • Sorry but I'm [not seeing a question here](https://stackoverflow.com/help/dont-ask). Is there a specific problem you are facing? (Stack overflow is best for "practical, answerable questions"). – Brits Jun 26 '22 at 02:30
  • Sorry I am so late to respond, I will avoid this in next post. Thank you – Murugesan Jul 06 '22 at 07:19

0 Answers0