-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help me #82
Comments
Can you post the code of your client? |
ok !
maybe a problem connection with my converter ? |
Hi, from serial import Serial
from collections import defaultdict
from umodbus.server.serial import get_server
from umodbus.server.serial.rtu import RTUServer
s = Serial('COM11')
s.timeout = 1
print(s)
data_store = defaultdict(int)
app = get_server(RTUServer, s)
@app.route(slave_ids=[1], function_codes=[3, 4], addresses=list(range(0, 32)))
def read_data_store(slave_id, function_code, address):
"""" Return value of address. """
return data_store[address]
@app.route(slave_ids=[1], function_codes=[6, 16], addresses=list(range(0, 32)))
def write_data_store(slave_id, function_code, address, value):
"""" Set value for address. """
data_store[address] = value
# Configuring the Data
write_data_store(1,16,1,999)
write_data_store(1,16,2,888)
write_data_store(1,16,3,777)
write_data_store(1,16,4,666)
if __name__ == '__main__':
try:
app.serve_forever()
print(rdata1)
finally:
app.shutdown()
app.server_close() The code of my master
Doesn't work every time. problem time ? i am on same PC Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all,
how to create an RTU slave with umodbus on the COM6 port?
Can I query it with "minimalmodbus"?
With "minimalmodbus" I don't get any answer.
minimalmodbus.Instrument<id=0x9abcd0, address=1, mode=rtu, close_port_after_each_call=False, precalculate_read_size=True, debug=True, serial=Serial<id=0x9ab930, open=True>(port='COM1', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=0.05, xonxoff=False, rtscts=False, dsrdtr=False)>
Is this the right procedure ?
Thanks
The text was updated successfully, but these errors were encountered: