EasyModbus


NameEasyModbus JSON
Version 2.0.1 PyPI version JSON
download
home_pagehttp://www.easymodbustcp.net
SummaryTHE standard library for Modbus RTU and Modbus TCP - See www.EasyModbusTCP.NET for documentation
upload_time2023-01-01 20:57:25
maintainer
docs_urlNone
authorStefan Rossmann
requires_python
licenseMIT
keywords easymodbus modbus serial rtu tcp easymodbustcp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## EasyModbusTCP - THE standard library for Modbus RTU and Modbus TCP

Visit www.EasyModbusTCP.net for more informations and Codesamples

### Table of Contents
1. [Installation](#installation)
2. [Supported Function codes](#functioncodes)  
3. [Basic Usage](#basicusage)  
   3.1. [Instantiation](#instatiation)  
   3.2. [Connect](#connect)  
   3.3. [Close connection](#close)  
   3.4. [Read values](#readvalues)  
   3.5. [Write single values](#writesinglevalues)  
4. [Examples](#examples)  
   4.1. [Example 1 (Read two Holding Registres from Siemens S7-1200 via Modbus-TCP)](#example1)  
5. [Library Documentation](#documentation)  
   5.1 [Methods](#methods)  
   5.2 [Properties](#properties)  
   5.3 [Helper functions](#functions)

<div id="installation"/>

### 1. Installation:

pip install EasyModbus

### Requirements:

>Python 3.8

pyserial (only for Modbus RTU)


<div id="functioncodes"/>

### 2. Supported Function codes 

- Read Coils (FC1)
- Read Discrete Inputs (FC2)
- Read Holding Registers (FC3)
- Read Input Registers (FC4)
- Write Single Coil (FC5)
- Write Single Register (FC6)
- Write Multiple Coils (FC15)
- Write Multiple Registers (FC16)

<div id="basicusage"/>

### 3. Basic usage

<div id="instantiation"/>

#### 3.1 Instantiate ModbusClient class

The arguments passed during the instantiation are important in order to differentiate between Modbus RTU (via the serial interface) and Modbus TCP (via Ethernet).  
If an argument is passed during the instantiation, it is the serial interface that is used with Modbus RTU (e.g. 'COM1' or '/dev/ttyUSB0').
Two arguments must be passed for Modbus TCP. This is the IP address and the port (usually 502)  

Example for **Modbus RTU**  
```python
import easymodbus.modbusClient
modbus_client = easymodbus.modbusClient.ModbusClient('/dev/ttyUSB0')
```

Example for **Modbus TCP**  
```python
import easymodbus.modbusClient
modbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.52', 502)
```

<div id="connect"/>

#### 3.2 Connect

To connect to a Modbus-TCP Server or to a Modbus-RTU Slave simply use the "connect" Method. If Modbus-RTU is used, make sure to set the properties for serial connection (Baudrate, Parity, Stopbits), if they differ from the default values, **before** the "connect" Method is executed. 

```python
modbus_client.connect()
```

<div id="close"/>

#### 3.3 Close connection

To close the connection to a Modbus-TCP Server or to a Modbus-RTU Slave simply use the "close" Method.

```python
modbus_client.close()
```

<div id="readvalues"/>

#### 3.4 Read Values

The following functioncodes are used to read values from the remote device (Modbus-TCP Server or Modbus-RTU Client)

- Read Coils (FC1) - Method "read_coils"
- Read Discrete Inputs (FC2) - Method "read_discrete_inputs"
- Read Holding Registers (FC3) - Method "read_holding_registers"
- Read Input Registers (FC4) - Method "read_input_registers"

IMPORTANT: Usually there is a Register shift between the request and the server address range
The Server address Range starts with address "1" but the Request that is sent starts with "0"
In the example method call we read Register 1 and 2 (Because register "0" does not exist)
Please check the documentation of your device (or try it out)

```python
import easymodbus.modbusClient

#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect
modbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)
modbus_client.connect()

#The first argument is the starting address, the second argument is the quantity.
coils = modbus_client.read_coils(0, 2)	#Read coils 1 and 2 from server 
discrete_inputs = modbus_client.read_discreteinputs(10, 10)	#Read discrete inputs 11 to 20 from server 
input_registers = modbus_client.read_inputregisters(0, 10)	#Read input registers 1 to 10 from server 
holding_registers = modbus_client.read_holdingregisters(0, 5)	#Read holding registers 1 to 5 from server 
modbus_client.close()
```

<div id="writesinglevalues"/>

#### 3.5 Write single Values

The following functioncodes are used to write single values (Holding Registers or Coils) from the remote device (Modbus-TCP Server or Modbus-RTU Client)

- Write Single Coil (FC5) - Method "write_single_coil"
- Write Single Register (FC6) - Method "write_single_register"

IMPORTANT: Usually there is a Register shift between the request and the server address range
The Server address Range starts with address "1" but the Request that is sent starts with "0"
In the example method call we write to Register 1 (Because register "0" does not exist)
Please check the documentation of your device (or try it out)

```python
import easymodbus.modbusClient

#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect
modbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)
modbus_client.connect()

holding_register_value = 115
coil_value = True
#The first argument is the address, the second argument is the value.
modbus_client.write_single_register(0, holding_register_value)	#Write value "115" to Holding Register 1 
modbus_client.write_single_coil(10, coil_value)	#Set Coil 11 to True
modbus_client.close()
```

<div id="examples"/>

### 4. Get started - Examples

All examples are available in the folder "examples" in the Git-Repository

<div id="example1"/>

#### 4.1 Example 1 (Read two Holding Registres from Modbus-TCP Server)
First we create an instance of a Modbus-TCP class (Server IP-Address and Port)
Then we Read 2 Holding Registers from the Server.  
IMPORTANT: Usually there is a Register shift between the request and the server address range
The Server address Range starts with address "1" but the Request that is sent starts with "0"
In the example method call we read Register 1 and 2 (Because register "0" does not exist)
Please check the documentation of your device (or try it out)


```python
import easymodbus.modbusClient

#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect
modbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)
modbus_client.connect()

#The first argument is the starting registers, the second argument is the quantity.
register_values = modbus_client.read_holdingregisters(0, 2)

print("Value of Register #1:" + str(register_values[0]))
print("Value of Register #2:" + str(register_values[1])) 

#Close the Port
modbus_client.close()
```

<div id="documentation"/>

### 5. Library Documentation

Class:  ModbusClient

<div id="methods"/>

#### 5.1 Methods

**Constructor def \_\_init__(self, \*params)**

<u>Constructor for Modbus RTU (serial line):</u>
modbusClient = ModbusClient.ModbusClient(‘COM1’)
First Parameter is the serial Port

<u>Constructor for Modbus TCP:</u>
modbusClient = ModbusClient.ModbusClient(‘127.0.0.1’, 502)
First Parameter ist the IP-Address of the Server to connect to
Second Parameter is the Port the Server listens to

**def connect(self)**

Connects to a Modbus-TCP Server or a Modbus-RTU Slave with the given Parameters

**def close(self)**

Closes Serial port, or TCP-Socket connection

**def read_discrete_inputs(self, starting_address, quantity)**

Read Discrete Inputs from Server device (Function code 2)  
starting_address: First discrete input to read  
quantity: Number of discrete Inputs to read  
returns: List of bool values [0..quantity-1] which contains the discrete Inputs  

**def read_coils(self, starting_address, quantity)**

Read Coils from Server device (Function code 1)  
starting_address: First coil to read  
quantity: Number of coils to read  
returns: List of bool values [0..quantity-1] which contains the coils  

**def read_holding_registers(self, starting_address, quantity)**

Read Holding Registers from Server device (Function code 3)  
starting_address: First Holding Register to read  
quantity: Number of Holding Registers to read  
returns: List of int values [0..quantity-1] which contains the registers 

**def read_input_registers(self, starting_address, quantity)**

Read Input Registers from Server device (Function code 4)  
starting_address: First Input Register to read  
quantity: Number of Input Registers to read  
returns: List of int values [0..quantity-1] which contains the registers 

**def write_single_coil(self, starting_address, value)**

Write single Coil to Server device (Function code 5)  
starting_address: Coil to write  
value: Boolean value to write

**def write_single_register(self, starting_address, value)**

Write single Holding Register to Server device (Function code 6)  
starting_address: Holding Register to write  
value: int value to write

**def write_multiple_coils(self, starting_address, values)**

Write multiple Coils to Server device (Function code 15)  
starting_address: First coil to write  
value: List of Boolean values to write

**def write_multiple_registers(self, starting_address, values)**

Write multiple Holding Registers to Server device (Function code 16)  
starting_address: First Holding Register to write  
value: List of int values to write

**def read_discreteinputs(self, starting_address, quantity)**

deprecated - Use "read_discrete_inputs" instead

**def read_holdingregisters(self, starting_address, quantity)**

deprecated - Use "read_holding_registers" instead

**def read_inputregisters(self, starting_address, quantity)**

deprecated - Use "read_input_registers" instead

<div id="properties"/>

#### 5.2 Properties

**port**

Datatype: int  
Port were the Modbus-TCP Server is reachable (Standard is 502)

**ipaddress**

Datatype: str  
IP-Address of the Server to be connected

**unitidentifier**

Datatype: int  
Unit identifier in case of serial connection (Default = 1)

**baudrate**

Datatype: int  
Baudrate for serial connection (Default = 9600)

**parity**

Datatype: int  
Parity in case of serial connection 
The Helper class "Parity" can be used to define the parity (Default = Parity.even)  
For example: modbus_client.parity = easymodbus.modbusClient.Parity.odd  
Possible values are:
even = 0  
odd = 1  
none = 2  

**stopbits**

Datatype: int  
Stopbits in case of serial connection (Default = Stopbits.one) 
The Helper class "Stopbits" can be used to define the number of stopbits  
For example: modbus_client.stopbits = easymodbus.modbusClient.Stopbits.one  
Possible values are:
one = 0  
two = 1  
onePointFive = 2  

**timeout**

Datatype: int  
Max. time before an Exception is thrown (Default = 5)  

**is_connected**

Datatype: bool  
Returns true if a connection has been established (only read)

**debug**

Datatype: bool  
Enables/disables debug mode - In debug mode Request and Response and depending in the logging level the RAW-Data are displayed at the console output and stored in a logfile "logdata.txt"  
Disabled at default

**logging_level**
 
Sets or gets the logging level. Default value is logging.INFO. In this Request and Response including arguments are logged (if debug is enabled)  
if the level is set to logging.DEBUG also the RAW data transmitted and received are logged for debugging purposes.  
The are logged at the console output and stored in logfile.txt 


<div id="functions"/>

#### 5.3 Helper functions

**def convert_double_to_two_registers(doubleValue, register_order=RegisterOrder.lowHigh)**

Convert 32 Bit Value to two 16 Bit Value to send as Modbus Registers  
doubleValue: Value to be converted  
register_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  
return: 16 Bit Register values int[]  

**def convert_float_to_two_registers(floatValue, register_order=RegisterOrder.lowHigh)**

Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers  
floatValue: Value to be converted  
register_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  
return: 16 Bit Register values int[]  

**def convert_registers_to_double(registers, register_order=RegisterOrder.lowHigh)**

Convert two 16 Bit Registers to 32 Bit long value - Used to receive 32 Bit values from Modbus (Modbus Registers are 16 Bit long)  
registers: 16 Bit Registers  
register_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  
return: 32 bit value  

**def convert_registers_to_float(registers, register_order=RegisterOrder.lowHigh)**

Convert two 16 Bit Registers to 32 Bit real value - Used to receive float values from Modbus (Modbus Registers are 16 Bit long)  
registers: 16 Bit Registers  
register_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  
return: 32 bit value real
            

Raw data

            {
    "_id": null,
    "home_page": "http://www.easymodbustcp.net",
    "name": "EasyModbus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "easymodbus modbus serial RTU TCP EasyModbusTCP",
    "author": "Stefan Rossmann",
    "author_email": "info@rossmann-engineering.de",
    "download_url": "https://files.pythonhosted.org/packages/43/3c/c5f9a38041347d27e0f8393a93a850fee4c3efeb4ee9487d793f4009d9a1/EasyModbus-2.0.1.tar.gz",
    "platform": null,
    "description": "## EasyModbusTCP - THE standard library for Modbus RTU and Modbus TCP\n\nVisit www.EasyModbusTCP.net for more informations and Codesamples\n\n### Table of Contents\n1. [Installation](#installation)\n2. [Supported Function codes](#functioncodes)  \n3. [Basic Usage](#basicusage)  \n   3.1. [Instantiation](#instatiation)  \n   3.2. [Connect](#connect)  \n   3.3. [Close connection](#close)  \n   3.4. [Read values](#readvalues)  \n   3.5. [Write single values](#writesinglevalues)  \n4. [Examples](#examples)  \n   4.1. [Example 1 (Read two Holding Registres from Siemens S7-1200 via Modbus-TCP)](#example1)  \n5. [Library Documentation](#documentation)  \n   5.1 [Methods](#methods)  \n   5.2 [Properties](#properties)  \n   5.3 [Helper functions](#functions)\n\n<div id=\"installation\"/>\n\n### 1. Installation:\n\npip install EasyModbus\n\n### Requirements:\n\n>Python 3.8\n\npyserial (only for Modbus RTU)\n\n\n<div id=\"functioncodes\"/>\n\n### 2. Supported Function codes \n\n- Read Coils (FC1)\n- Read Discrete Inputs (FC2)\n- Read Holding Registers (FC3)\n- Read Input Registers (FC4)\n- Write Single Coil (FC5)\n- Write Single Register (FC6)\n- Write Multiple Coils (FC15)\n- Write Multiple Registers (FC16)\n\n<div id=\"basicusage\"/>\n\n### 3. Basic usage\n\n<div id=\"instantiation\"/>\n\n#### 3.1 Instantiate ModbusClient class\n\nThe arguments passed during the instantiation are important in order to differentiate between Modbus RTU (via the serial interface) and Modbus TCP (via Ethernet).  \nIf an argument is passed during the instantiation, it is the serial interface that is used with Modbus RTU (e.g. 'COM1' or '/dev/ttyUSB0').\nTwo arguments must be passed for Modbus TCP. This is the IP address and the port (usually 502)  \n\nExample for **Modbus RTU**  \n```python\nimport easymodbus.modbusClient\nmodbus_client = easymodbus.modbusClient.ModbusClient('/dev/ttyUSB0')\n```\n\nExample for **Modbus TCP**  \n```python\nimport easymodbus.modbusClient\nmodbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.52', 502)\n```\n\n<div id=\"connect\"/>\n\n#### 3.2 Connect\n\nTo connect to a Modbus-TCP Server or to a Modbus-RTU Slave simply use the \"connect\" Method. If Modbus-RTU is used, make sure to set the properties for serial connection (Baudrate, Parity, Stopbits), if they differ from the default values, **before** the \"connect\" Method is executed. \n\n```python\nmodbus_client.connect()\n```\n\n<div id=\"close\"/>\n\n#### 3.3 Close connection\n\nTo close the connection to a Modbus-TCP Server or to a Modbus-RTU Slave simply use the \"close\" Method.\n\n```python\nmodbus_client.close()\n```\n\n<div id=\"readvalues\"/>\n\n#### 3.4 Read Values\n\nThe following functioncodes are used to read values from the remote device (Modbus-TCP Server or Modbus-RTU Client)\n\n- Read Coils (FC1) - Method \"read_coils\"\n- Read Discrete Inputs (FC2) - Method \"read_discrete_inputs\"\n- Read Holding Registers (FC3) - Method \"read_holding_registers\"\n- Read Input Registers (FC4) - Method \"read_input_registers\"\n\nIMPORTANT: Usually there is a Register shift between the request and the server address range\nThe Server address Range starts with address \"1\" but the Request that is sent starts with \"0\"\nIn the example method call we read Register 1 and 2 (Because register \"0\" does not exist)\nPlease check the documentation of your device (or try it out)\n\n```python\nimport easymodbus.modbusClient\n\n#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect\nmodbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)\nmodbus_client.connect()\n\n#The first argument is the starting address, the second argument is the quantity.\ncoils = modbus_client.read_coils(0, 2)\t#Read coils 1 and 2 from server \ndiscrete_inputs = modbus_client.read_discreteinputs(10, 10)\t#Read discrete inputs 11 to 20 from server \ninput_registers = modbus_client.read_inputregisters(0, 10)\t#Read input registers 1 to 10 from server \nholding_registers = modbus_client.read_holdingregisters(0, 5)\t#Read holding registers 1 to 5 from server \nmodbus_client.close()\n```\n\n<div id=\"writesinglevalues\"/>\n\n#### 3.5 Write single Values\n\nThe following functioncodes are used to write single values (Holding Registers or Coils) from the remote device (Modbus-TCP Server or Modbus-RTU Client)\n\n- Write Single Coil (FC5) - Method \"write_single_coil\"\n- Write Single Register (FC6) - Method \"write_single_register\"\n\nIMPORTANT: Usually there is a Register shift between the request and the server address range\nThe Server address Range starts with address \"1\" but the Request that is sent starts with \"0\"\nIn the example method call we write to Register 1 (Because register \"0\" does not exist)\nPlease check the documentation of your device (or try it out)\n\n```python\nimport easymodbus.modbusClient\n\n#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect\nmodbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)\nmodbus_client.connect()\n\nholding_register_value = 115\ncoil_value = True\n#The first argument is the address, the second argument is the value.\nmodbus_client.write_single_register(0, holding_register_value)\t#Write value \"115\" to Holding Register 1 \nmodbus_client.write_single_coil(10, coil_value)\t#Set Coil 11 to True\nmodbus_client.close()\n```\n\n<div id=\"examples\"/>\n\n### 4. Get started - Examples\n\nAll examples are available in the folder \"examples\" in the Git-Repository\n\n<div id=\"example1\"/>\n\n#### 4.1 Example 1 (Read two Holding Registres from Modbus-TCP Server)\nFirst we create an instance of a Modbus-TCP class (Server IP-Address and Port)\nThen we Read 2 Holding Registers from the Server.  \nIMPORTANT: Usually there is a Register shift between the request and the server address range\nThe Server address Range starts with address \"1\" but the Request that is sent starts with \"0\"\nIn the example method call we read Register 1 and 2 (Because register \"0\" does not exist)\nPlease check the documentation of your device (or try it out)\n\n\n```python\nimport easymodbus.modbusClient\n\n#create an instance of a Modbus-TCP class (Server IP-Address and Port) and connect\nmodbus_client = easymodbus.modbusClient.ModbusClient('192.168.178.110', 502)\nmodbus_client.connect()\n\n#The first argument is the starting registers, the second argument is the quantity.\nregister_values = modbus_client.read_holdingregisters(0, 2)\n\nprint(\"Value of Register #1:\" + str(register_values[0]))\nprint(\"Value of Register #2:\" + str(register_values[1])) \n\n#Close the Port\nmodbus_client.close()\n```\n\n<div id=\"documentation\"/>\n\n### 5. Library Documentation\n\nClass:  ModbusClient\n\n<div id=\"methods\"/>\n\n#### 5.1 Methods\n\n**Constructor def \\_\\_init__(self, \\*params)**\n\n<u>Constructor for Modbus RTU (serial line):</u>\nmodbusClient = ModbusClient.ModbusClient(\u2018COM1\u2019)\nFirst Parameter is the serial Port\n\n<u>Constructor for Modbus TCP:</u>\nmodbusClient = ModbusClient.ModbusClient(\u2018127.0.0.1\u2019, 502)\nFirst Parameter ist the IP-Address of the Server to connect to\nSecond Parameter is the Port the Server listens to\n\n**def connect(self)**\n\nConnects to a Modbus-TCP Server or a Modbus-RTU Slave with the given Parameters\n\n**def close(self)**\n\nCloses Serial port, or TCP-Socket connection\n\n**def read_discrete_inputs(self, starting_address, quantity)**\n\nRead Discrete Inputs from Server device (Function code 2)  \nstarting_address: First discrete input to read  \nquantity: Number of discrete Inputs to read  \nreturns: List of bool values [0..quantity-1] which contains the discrete Inputs  \n\n**def read_coils(self, starting_address, quantity)**\n\nRead Coils from Server device (Function code 1)  \nstarting_address: First coil to read  \nquantity: Number of coils to read  \nreturns: List of bool values [0..quantity-1] which contains the coils  \n\n**def read_holding_registers(self, starting_address, quantity)**\n\nRead Holding Registers from Server device (Function code 3)  \nstarting_address: First Holding Register to read  \nquantity: Number of Holding Registers to read  \nreturns: List of int values [0..quantity-1] which contains the registers \n\n**def read_input_registers(self, starting_address, quantity)**\n\nRead Input Registers from Server device (Function code 4)  \nstarting_address: First Input Register to read  \nquantity: Number of Input Registers to read  \nreturns: List of int values [0..quantity-1] which contains the registers \n\n**def write_single_coil(self, starting_address, value)**\n\nWrite single Coil to Server device (Function code 5)  \nstarting_address: Coil to write  \nvalue: Boolean value to write\n\n**def write_single_register(self, starting_address, value)**\n\nWrite single Holding Register to Server device (Function code 6)  \nstarting_address: Holding Register to write  \nvalue: int value to write\n\n**def write_multiple_coils(self, starting_address, values)**\n\nWrite multiple Coils to Server device (Function code 15)  \nstarting_address: First coil to write  \nvalue: List of Boolean values to write\n\n**def write_multiple_registers(self, starting_address, values)**\n\nWrite multiple Holding Registers to Server device (Function code 16)  \nstarting_address: First Holding Register to write  \nvalue: List of int values to write\n\n**def read_discreteinputs(self, starting_address, quantity)**\n\ndeprecated - Use \"read_discrete_inputs\" instead\n\n**def read_holdingregisters(self, starting_address, quantity)**\n\ndeprecated - Use \"read_holding_registers\" instead\n\n**def read_inputregisters(self, starting_address, quantity)**\n\ndeprecated - Use \"read_input_registers\" instead\n\n<div id=\"properties\"/>\n\n#### 5.2 Properties\n\n**port**\n\nDatatype: int  \nPort were the Modbus-TCP Server is reachable (Standard is 502)\n\n**ipaddress**\n\nDatatype: str  \nIP-Address of the Server to be connected\n\n**unitidentifier**\n\nDatatype: int  \nUnit identifier in case of serial connection (Default = 1)\n\n**baudrate**\n\nDatatype: int  \nBaudrate for serial connection (Default = 9600)\n\n**parity**\n\nDatatype: int  \nParity in case of serial connection \nThe Helper class \"Parity\" can be used to define the parity (Default = Parity.even)  \nFor example: modbus_client.parity = easymodbus.modbusClient.Parity.odd  \nPossible values are:\neven = 0  \nodd = 1  \nnone = 2  \n\n**stopbits**\n\nDatatype: int  \nStopbits in case of serial connection (Default = Stopbits.one) \nThe Helper class \"Stopbits\" can be used to define the number of stopbits  \nFor example: modbus_client.stopbits = easymodbus.modbusClient.Stopbits.one  \nPossible values are:\none = 0  \ntwo = 1  \nonePointFive = 2  \n\n**timeout**\n\nDatatype: int  \nMax. time before an Exception is thrown (Default = 5)  \n\n**is_connected**\n\nDatatype: bool  \nReturns true if a connection has been established (only read)\n\n**debug**\n\nDatatype: bool  \nEnables/disables debug mode - In debug mode Request and Response and depending in the logging level the RAW-Data are displayed at the console output and stored in a logfile \"logdata.txt\"  \nDisabled at default\n\n**logging_level**\n \nSets or gets the logging level. Default value is logging.INFO. In this Request and Response including arguments are logged (if debug is enabled)  \nif the level is set to logging.DEBUG also the RAW data transmitted and received are logged for debugging purposes.  \nThe are logged at the console output and stored in logfile.txt \n\n\n<div id=\"functions\"/>\n\n#### 5.3 Helper functions\n\n**def convert_double_to_two_registers(doubleValue, register_order=RegisterOrder.lowHigh)**\n\nConvert 32 Bit Value to two 16 Bit Value to send as Modbus Registers  \ndoubleValue: Value to be converted  \nregister_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  \nreturn: 16 Bit Register values int[]  \n\n**def convert_float_to_two_registers(floatValue, register_order=RegisterOrder.lowHigh)**\n\nConvert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers  \nfloatValue: Value to be converted  \nregister_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  \nreturn: 16 Bit Register values int[]  \n\n**def convert_registers_to_double(registers, register_order=RegisterOrder.lowHigh)**\n\nConvert two 16 Bit Registers to 32 Bit long value - Used to receive 32 Bit values from Modbus (Modbus Registers are 16 Bit long)  \nregisters: 16 Bit Registers  \nregister_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  \nreturn: 32 bit value  \n\n**def convert_registers_to_float(registers, register_order=RegisterOrder.lowHigh)**\n\nConvert two 16 Bit Registers to 32 Bit real value - Used to receive float values from Modbus (Modbus Registers are 16 Bit long)  \nregisters: 16 Bit Registers  \nregister_order: Desired Word Order (Low Register first or High Register first - Default: RegisterOrder.lowHigh  \nreturn: 32 bit value real",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "THE standard library for Modbus RTU and Modbus TCP - See www.EasyModbusTCP.NET for documentation",
    "version": "2.0.1",
    "split_keywords": [
        "easymodbus",
        "modbus",
        "serial",
        "rtu",
        "tcp",
        "easymodbustcp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "82e34f557cf5071cfd10c580085cf4b4",
                "sha256": "aadd591fa105c1de02034743283a4cde55f93c8634f62a191513ef636edb6dfc"
            },
            "downloads": -1,
            "filename": "EasyModbus-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "82e34f557cf5071cfd10c580085cf4b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17195,
            "upload_time": "2023-01-01T20:57:25",
            "upload_time_iso_8601": "2023-01-01T20:57:25.551888Z",
            "url": "https://files.pythonhosted.org/packages/43/3c/c5f9a38041347d27e0f8393a93a850fee4c3efeb4ee9487d793f4009d9a1/EasyModbus-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-01 20:57:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "easymodbus"
}
        
Elapsed time: 0.02730s