-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sections Usage and Functions to docs.
- Loading branch information
Showing
9 changed files
with
294 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Functions | ||
--------- | ||
|
||
The Modbus functions have been implemented. | ||
|
||
01: Read Coils | ||
============== | ||
|
||
.. autoclass:: umodbus.functions.ReadCoils | ||
|
||
02: Read Discrete Inputs | ||
======================== | ||
|
||
.. autoclass:: umodbus.functions.ReadDiscreteInputs | ||
|
||
03: Read Holding Registers | ||
========================== | ||
|
||
.. autoclass:: umodbus.functions.ReadHoldingRegisters | ||
|
||
04: Read Input Registers | ||
======================== | ||
|
||
.. autoclass:: umodbus.functions.ReadInputRegisters | ||
|
||
05: Write Single Coil | ||
===================== | ||
|
||
.. autoclass:: umodbus.functions.WriteSingleCoil | ||
|
||
06: Write Single Register | ||
========================= | ||
|
||
.. autoclass:: umodbus.functions.WriteSingleRegister | ||
|
||
15: Write Multiple Coils | ||
======================== | ||
|
||
.. autoclass:: umodbus.functions.WriteMultipleCoils | ||
|
||
16: Write Multiple Register | ||
=========================== | ||
|
||
.. autoclass:: umodbus.functions.WriteMultipleRegisters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
# scripts/examples/simple_data_store.py | ||
from umodbus import get_server | ||
from collections import defaultdict | ||
|
||
# A very simple data store which maps addresss against their values. | ||
data_store = defaultdict(int) | ||
|
||
app = get_server('localhost', 502) | ||
|
||
|
||
@app.route(slave_ids=[1], function_codes=[3, 4], addresses=list(range(0, 10))) | ||
def read_data_store(slave_id, address): | ||
"""" Return value of address. """ | ||
return data_store[address] | ||
|
||
|
||
@app.route(slave_ids=[1], function_codes=[6, 16], addresses=list(range(0, 10))) | ||
def write_data_store(slave_id, address, value): | ||
"""" Set value for address. """ | ||
data_store[address] = value | ||
|
||
if __name__ == '__main__': | ||
try: | ||
app.serve_forever() | ||
finally: | ||
app.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.