@@ -4,7 +4,7 @@ Quick start guide
44Overview of the package
55-----------------------
66
7- pyModbusTCP give access to modbus/TCP server through the ModbusClient object.
7+ pyModbusTCP give access to modbus/TCP server through the ModbusClient object.
88This class is define in the client module.
99
1010Since version 0.1.0, a server is available as ModbusServer class. This server
@@ -24,12 +24,12 @@ Package setup
2424
2525from PyPi::
2626
27- # for Python 2.7
28- sudo pip-2.7 install pyModbusTCP
29- # or for Python 3.2
30- sudo pip-3.2 install pyModbusTCP
31- # or upgrade from an older release
32- sudo pip-3.2 install pyModbusTCP --upgrade
27+ # for Python 2
28+ sudo pip2 install pyModbusTCP
29+ # or for Python 3
30+ sudo pip3 install pyModbusTCP
31+ # upgrade from an older release
32+ sudo pip3 install pyModbusTCP --upgrade
3333
3434from Github::
3535
@@ -71,7 +71,7 @@ For open/close socket before/after read or write, do this::
7171
7272 c = ModbusClient(host="localhost", auto_open=True, auto_close=True)
7373
74- You can also open manually the TCP link. After this, you call a modbus request
74+ You can also open manually the TCP link. After this, you call a modbus request
7575function (see list in next section)::
7676
7777 if c.open():
148148
149149 c.debug(True)
150150
151- when debug is enable all debug message is print on console and you can see
151+ when debug is enable all debug message is print on console and you can see
152152modbus frame::
153153
154154 c.read_holding_registers(0, 4)
@@ -199,15 +199,23 @@ Sample data mangling, usefull for interface PLC device.
199199 # display "[True, False, True, False, False, False, False, False]"
200200 print(utils.get_bits_from_int(0x05, val_size=8))
201201
202- - gateway between IEEE single precision float and python float ::
202+ - IEEE single/double precision floating-point ::
203203
204204 from pyModbusTCP import utils
205205
206- # convert python float 0.3 to 0x3e99999a (32 bits IEEE representation)
206+ # 32 bits IEEE single precision
207+ # encode : python float 0.3 -> int 0x3e99999a
207208 # display "0x3e99999a"
208209 print(hex(utils.encode_ieee(0.3)))
209-
210- # convert python float 0.3 to 0x3e99999a (32 bits IEEE representation)
210+ # decode: python int 0x3e99999a -> float 0.3
211211 # display "0.300000011921" (it's not 0.3, precision leak with float...)
212212 print(utils.decode_ieee(0x3e99999a))
213213
214+ # 64 bits IEEE double precision
215+ # encode: python float 6.62606957e-34 -> int 0x390b860bb596a559
216+ # display "0x390b860bb596a559"
217+ print(hex(utils.encode_ieee(6.62606957e-34, double=True)))
218+ # decode: python int 0x390b860bb596a559 -> float 6.62606957e-34
219+ # display "6.62606957e-34"
220+ print(utils.decode_ieee(0x390b860bb596a559, double=True))
221+
0 commit comments