Modsak Manual v3.14 - 2.1. General settings
Thesettings page enables you to set the following items:
Mode. Modsak can be run in one of three modes. In Master mode, Modsak sends requests to a Modbus slave. In Slave mode, Modsak simulates a Modbus device, responding to requests from Modbus masters. In Monitor mode, Modsak relays messages between a master and a slave, displaying the register values that are transferred. See the section Setup overview for more details.
Slave ID. The Slave ID is what is called the "slave address" in the original Modbus specification, and is called the "unit identifier" in the Modbus/TCP specification. It should be in the range 0 to 255.
A zero slave identifier is used in write requests as a broadcast identifier (each slave that receives the message should store the values supplied in the request, but should not normally send a response). If Modsak is in slave mode and the Slave ID is set to 0, Modsak will act on all requests it receives, regardless of the slave identifier in the request. The serial specification limits the range of slave identifiers to 0 to 247, for no apparent reason. The Modbus/TCP implementation guide suggests that Modbus/TCP slaves that can be uniquely identified by their IP address should use slave identifier 255.
Number of Retries. The Number of Retries field specifies how many times Modsak should retry a request that it has not received a response to.
Request Delay. The Request Delay field is used to insert a time delay before each read or write request when polling and when sending a sequence of commands. This delay may be necessary in a 2-wire RS485 RTU setup, to enable slaves to separate master request messages from response messages sent by other other slaves. The delay may also be used to reduce the load on the slave or on the computer running Modsak. The delay is measured in milliseconds. (Also see Pass Delay.)
Response Delay. The Response Delay field is used in slave mode and monitor mode to insert a time delay before sending a response to a Modbus request. A delay may be necessary when using RS485 to give the master time to switch from transmitting to receiving. The delay is measured in milliseconds.
Max PDU size. This field specifies the maximum allowable number of bytes in the PDU (Protocol Data Unit) of Modbus messages. You may need to reduce the maximum PDU size when communicating over some networks to avoid fragmentation of messages.
In master mode, Modsak will not send any request that exceeds the PDU limit, or whose response would exceed the limit. In slave mode, Modsak will discard any request that exceeds the PDU limit, and will return an "Illegal Data Value" error response to any request that would require a response exceeding the limit. See the note on message size limits for more information.
Check Count Limits. The current Modbus specification specifies arbitrary limits on the counts in some Modbus requests (e.g. a maximum of 2000 coils in a Read Coils request). Select this checkbox if you want Modsak to check these limits.
Since Modsak can handle non-standard register sizes, count limits for holding and input registers are multiplied by 2 and then interpreted as byte count limits. In master mode, Modsak will warn you if you send a request that exceeds a count limit or whose response would exceed a limit. In slave mode, Modsak enforces a count limit by returning an "Illegal Data Value" error response to any request whose count exceeds the limit. See the note on message size limits for more information.
Strict Checking. Normally Modsak checks that received Modbus messages conform to the current Modbus specification, and rejects them if they do not. Some of these checks are not essential: messages that fail them can still be interpreted correctly. Deselect Strict Checking if you want Modsak to be more tolerant of non-conforming messages.
The checks enabled by the Strict Checking setting are:
The byte count in a response message must match the count in the request message (commands 1 Read Coils, 2 Read Discrete Inputs, 3 Read Holding Registers, 4 Read Input Registers, 20 Read File Record, 23 Read/Write Multiple Holding Registers).
The byte count in a request message must match the count (commands 15 Write Multiple Coils, 16 Write Multiple Holding Registers, 23 Read/Write Multiple Holding Registers).
A response message must correctly echo data that was sent in the request (commands 5 Write Single Coil, 6 Write Single Holding Register, 8 Diagnostics, 15 Write Multiple Coils, 16 Write Multiple Holding Registers, 21 Write File Record, 22 Mask Write Holding Register, 43/14 Read Device Identification).
The count in a request message must not be zero (commands 1 Read Coils, 2 Read Discrete Inputs, 3 Read Holding Registers, 4 Read Input Registers, 15 Write Multiple Coils, 16 Write Multiple Holding Registers, 20 Read File Record, 21 Write File Record, 23 Read/Write Multiple Holding Registers).
The value in a 5 Write Single Coil request must be 0000 or FF00.
The register addresses in Read File Record and Write File Record requests must be in the range 0 to 9999.
Unused fields in messages must be correctly set (command 43/14 Read Device Identification).
A message must not contain excess data.
Allow Long Messages. Some Modbus messages contain a count of the number of data bytes in the message. This byte-count is in a one-byte field, and so has a maximum value of 255, which limits the quantity of data that can be sent in a single message. The byte-count is actually redundant: it is possible to determine the number of data bytes in a message from the overall size of the message.
If you select Allow Long Messages, Modsak will ignore the byte-count field and determine the number of data bytes from the overall message size, and will set the byte-count to 0 when sending messages containing more than 255 data bytes. If you also increase the Max PDU Size, Modsak will be able to send and receive messages containing more than 255 data bytes.
Sending messages containing more than 255 data bytes is non-standard and not widely supported. It may affect the detection of the end of messages when using the RTU packet type, and may affect the ability of the CRC/LRC check to detect errors. However, it should be reliable when using a socket (TCP or UDP) connection. Note that UDP datagrams are limited in size, so this will limit the size of Modbus messages that can be sent using UDP.
Use Write-Single Functions. Normally Modsak uses function code 15 (Write Multiple Coils) and function code 16 (Write Multiple Registers) for register writes. You can select this checkbox to use function code 5 (Write Single Coil) and function code 6 (Write Single Register) instead.