File: modbus_server.rst

package info (click to toggle)
python-umodbus 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 456 kB
  • sloc: python: 1,944; makefile: 166; sh: 5
file content (38 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Modbus Server
-------------

Viewpoint
=========

The uModbus server code is built with routing in mind. Routing (groups of)
requests to a certain callback is easy. This is in contrast with with
other Modbus implementation which often focus on reading and writing from a
data store.

Because of this difference in viewpoint uModbus doesn't know the concept of
Modbus' data models like discrete inputs, coils, input registers, holding
registers and their read/write properties.

Routing
=======

The routing system was inspired by Flask_. Like Flask, uModbus requires a global
app or server. This server contains a route map. Routes can be added to the
route map.

The following code example demonstrates how to implement a very simple data
store for 10 addresses.

Modbus TCP example
==================

.. include:: ../../scripts/examples/simple_tcp_server.py
    :code: python

Modbus RTU example
==================

.. include:: ../../scripts/examples/simple_rtu_server.py
    :code: python

.. _Flask: http://flask.pocoo.org/