@@ -28,21 +28,21 @@ You can install this package from:
2828
2929PyPI, the easy way:
3030
31- ::
31+ .. code-block :: bash
3232
3333 sudo pip install pyModbusTCP
3434
3535 GitHub:
3636
37- ::
37+ .. code-block :: bash
3838
3939 git clone https://github.com/sourceperl/pyModbusTCP.git
4040 cd pyModbusTCP
4141 sudo python setup.py install
4242
4343 GitHub with pip:
4444
45- ::
45+ .. code-block :: bash
4646
4747 sudo pip install git+https://github.com/sourceperl/pyModbusTCP.git
4848
@@ -54,30 +54,30 @@ See examples/ for full scripts.
5454include (for all samples)
5555~~~~~~~~~~~~~~~~~~~~~~~~~
5656
57- ::
57+ .. code-block :: python
5858
5959 from pyModbusTCP.client import ModbusClient
6060
6161 module init (TCP always open)
6262~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6363
64- ::
64+ .. code-block :: python
6565
6666 # TCP auto connect on first modbus request
6767 c = ModbusClient(host = " localhost" , port = 502 , unit_id = 1 , auto_open = True )
6868
6969 module init (TCP open/close for each request)
7070~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7171
72- ::
72+ .. code-block :: python
7373
7474 # TCP auto connect on modbus request, close after it
7575 c = ModbusClient(host = " 127.0.0.1" , auto_open = True , auto_close = True )
7676
7777 module init (with accessor functions)
7878~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7979
80- ::
80+ .. code-block :: python
8181
8282 c = ModbusClient()
8383 c.host(" localhost" )
@@ -89,7 +89,7 @@ module init (with accessor functions)
8989 Read 2x 16 bits registers at modbus address 0 :
9090~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9191
92- ::
92+ .. code-block :: python
9393
9494 regs = c.read_holding_registers(0 , 2 )
9595 if regs:
@@ -100,7 +100,7 @@ Read 2x 16 bits registers at modbus address 0 :
100100 Write value 44 and 55 to registers at modbus address 10 :
101101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102102
103- ::
103+ .. code-block :: python
104104
105105 if c.write_multiple_registers(10 , [44 ,55 ]):
106106 print (" write ok" )
@@ -120,13 +120,13 @@ On windows OS with older Python version (<3), win_inet_pton module is require. T
120120
121121install win_inet_pton:
122122
123- ::
123+ .. code-block :: bash
124124
125125 sudo pip install win_inet_pton
126126
127127 import win_inet_pton at beginning of your code:
128128
129- ::
129+ .. code-block :: python
130130
131131 import win_inet_pton
132132 from pyModbusTCP.client import ModbusClient
0 commit comments