Python


Include Module

 

- External function library module

To call the functions in our shared library with Python program, the external function library module (ctypes) is required.
Therefore, import the external function library module in the source code.


Description example :

import ctypes
 

- libmodbus definition module

To use the libmodbus functions in Python, files modbus.py, modbus_tcp.py and modbus_rtu.py are required.
Copy the above libmodbus definition module to the directory containing the created program, and import the definition module in the source code.


Description example :

import modbus

import modbus_tcp
* For rtu, enter "import modbus_rtu".
 

For more information, please refer to the sample program source code.

 

 

Execute Program

 

The description at the time of executing program is as follows.

 

Description example (Execute tcpmaster sample in Python 3.10) :

python3.10 tcpmaster.py