• PyTool Modbus TCP 1
  • PyTool Modbus TCP 2
  • PyTool Modbus TCP 3
  • PyTool Modbus TCP 4

PyTool Modbus TCP

PyTool Modbus TCP is a great tool for Modbus TCP developing, debugging and monitoring.
It features Python script capability that gives you the greatest flexibility.

Why script capability is desirable for Modbus TCP tool?
Electrical engineers find it handy to use a hand held device like Android phone or tablet to debug or monitor Modbus TCP communication in the field, factory or lab.
But nearly every Modbus TCP communication system got its own data format.
Searching in a sea of hex data like "02a5b4ca....ff000803" and trying to figure out what is happening is not pleasant at all.
That is where PyTool Modbus TCP comes to help.
With the ability to run custom Python script, PyTool Modbus TCP can read and parse any received data, display it in the way you want, and even act accordingly when it is needed.

There are script examples for quick start. Just copy and paste one of them to try them out.

There is also a handy Modbus TCP control interface for general use.

Script General Guide
=================

* The Python version used in this app is 3.7.

* This app is not designed as script editor although script can be edited in the script field.
The best way is to use your favorite script editor and then copy and paste the script.

* The script field is not in Python global environment.
If custom function is needed, pass all the references as arguments of the function and import packages needed inside the function.

* Always use 4 spaces for indentation to avoid weird errors.

* Most of the packages in standard Python library are available to import.

* If while loop is needed, always use `app.running_script` as condition in order to stop the script properly.

* Use `app.get_output()` to get the script output field as string.

* Use `app.set_output(object)` to display `object` in the script output field as string.

* Use `app.fc01_read_coils(mbid, addr, num)` to send function code 01 request.
mbid (int): Modbus ID
addr (int): Data Address
num (int): Number of Data
return (list of int): Requested Data List

* Use `app.fc02_read_discrete_inputs(mbid, addr, num)` to send function code 02 request.
mbid (int): Modbus ID
addr (int): Data Address
num (int): Number of Data
return (list of int): Requested Data List

* Use `app.fc03_read_holding_registers(mbid, addr, num)` to send function code 03 request.
mbid (int): Modbus ID
addr (int): Data Address
num (int): Number of Data
return (list of int): Requested Data List

* Use `app.fc04_read_input_registers(mbid, addr, num)` to send function code 04 request.
mbid (int): Modbus ID
addr (int): Data Address
num (int): Number of Data
return (list of int): Requested Data List

* Use `app.fc05_write_single_coil(mbid, addr, val)` to send function code 05 request.
mbid (int): Modbus ID
addr (int): Data Address
val (int): Data Value
return (int): Number of Data (always 1)

* Use `app.fc06_write_single_register(mbid, addr, val)` to send function code 06 request.
mbid (int): Modbus ID
addr (int): Data Address
val (int): Data Value
return (int): Number of Data (always 1)

* Use `app.fc15_write_multiple_coils(mbid, addr, vals)` to send function code 15 request.
mbid (int): Modbus ID
addr (int): Data Address
vals (list of int): Data Value List
return (int): Number of Data

* Use `app.fc16_write_multiple_registers(mbid, addr, vals)` to send function code 16 request.
mbid (int): Modbus ID
addr (int): Data Address
vals (list of int): Data Value List
return (int): Number of Data

* Use `app.msg_out` and `app.msg_in` to check request and response messages.

* Use `app.log_file(text)` to save a log file in storage.
The log file is located here [Storage Directory]/PyToolModbusTCP/log_[UTC Timestamp].txt.
text (str): Text Content
return (str): Full File Path

Category : Tools

Related searches

Reviews (1)

Shi. M. Jul 23, 2019     

It is a very useful and flexible Modbus TCP tool! With Python script feature its potential is unlimited.