MBLogic for an open world in automation
PollMB is a simple Modbus/TCP command line client with the following features:
PollWS is a simple client which is similar to PollMB, but supports a Modbus-like web service.
The following Modbus functions are supported:
Address, function codes, and other values are specified by means of command line parameters. If a parameter is omitted, its default value is used. The parameters are:
Parameter | Description | Default Value |
---|---|---|
-h | Host name of the ModbusTCP server1 | localhost |
-p | Port number of the ModbusTCP server | 502 (PollMB) 80 (PollWS) |
-t | Receive time-out in seconds2 | 60 (mininum = 1) |
1 Note: -h (host). For PollMB, this is the IP address or domain name.
For PollWS, this is the URL to the web service, including IP address and any
additional URL path.
2 Note: -t (time-out) is accepted by PollWS, but is ignored.
Parameter | Description | Default Value |
---|---|---|
-f | Function | 1 |
-a | Address (Modbus memory) | 0 |
-q | Quantity of addresses | 1 |
-u | Unit ID | 1 |
Parameter | Description | Default Value |
---|---|---|
-r | Repeats. Number of times to perform the poll | 1 |
-y | Delay time between repeats in milliseconds1 | 1 |
-d | Data to send to the server | 0000 |
-s | Silent mode. 'Y' or 'y' will suppress displaying data | 'no' |
1Note: Actual delay time is affected by the resolution of the operating system process scheduler.
The following command line return codes are defined:
Return Code | Description |
---|---|
0 | No errors |
2 | Bad command line |
3 | Program was terminated from keyboard |
4 | Invalid data for modbus function |
5 | Error communicating with host |
6 | Invalid modbus parameters |
PollMB is normally used from the command line. For Linux, the syntax is:
Example:
./pollmb.py <parameters>
For Microsoft Windows, the syntax is:
Example:
python pollmb.py <parameters>
A typical example is:
Example:Example:
./pollmb.py -h 192.168.10.1 -p 8502 -t 10 -f 16 -a 6789 -q 2 -u 45 -d 0123abcd
PollWS uses a similar syntax. For Linux, the syntax is:
Example:
./pollws.py <parameters>
For Microsoft Windows, the syntax is:
Example:
python pollws.py <parameters>
A typical example is:
Example:Example:
./pollws.py -h 192.168.10.1/modbus -p 8502 -t 10 -f 16 -a 6789 -q 2 -u 45 -d 0123abcd