ModTest Manual v2.10 - 2.3. 32/64-bit Value Settings

Download manual: PDF HTML

2.3. 32/64-bit Value Settings

The official Modbus protocol (in both the original Modbus specification and the current Modbus specification) only allows 1-bit and 16-bit integer values to be transferred. Many manufacturers have extended the protocol to allow 32-bit and 64-bit values, and also to allow floating-point values. Fortunately, everyone seems to have used the IEEE format for floating-point numbers, but that is where the agreement ends. The 32/64-bit Value Settings page enables you to configure ModTest to handle all implementations of 32/64-bit values that we know of.

  • Little Endian. Modbus is a "big-endian" protocol: that is, the more significant byte of a 16-bit value is sent before the less significant byte. It seems obvious that 32-bit and 64-bit values should also be transferred using big-endian order. However, some manufacturers have chosen to treat 32-bit and 64-bit values as being composed of 16-bit words, and to transfer the words in little-endian order. For example, the 32-bit value 0x12345678 would be transferred as 0x56 0x78 0x12 0x34. You should select the Little Endian checkbox to use this mixed ordering.

  • Word Registers. Each register in the Modbus protocol holds a single (16-bit) value. The simplest way to extend the protocol to handle 32-bit and 64-bit values is to allow registers that contain these larger values. However, some manufacturers have chosen to keep to the 16-bit register size, and use 2 registers to hold a 32-bit value, and 4 registers to hold a 64-bit value. For example, if a 32-bit value is stored at address 100, then register 100 would hold one half of the value and register 101 would hold the other half of the value. Some devices will actually allow you to access the halves of the value independently; others will only allow accesses that transfer the complete value (thus making address 101 in the example an invalid address).

    You should select the Word Registers checkbox to use multiple registers to store large values, and leave the checkbox unselected to use a single register to hold each value.

  • Word Count. Some Modbus requests (e.g function 3 Read Holding Registers, and function 16 Write Multiple Registers) include a count of how many registers/values are to be transferred. There are three possible interpretations for this count:

    • The number of values to be transferred.

    • The number of 16-bit words to be transferred.

    • The number of registers to be transferred.

    In the official Modbus protocol, these three interpretations are equivalent, since all values and all registers are 16-bit. When 32-bit and 64-bit values and/or registers are allowed, the three interpretations become distinct. However, the third interpretation will be equivalent to one or other of the first two, depending on the Word Registers setting, so ModTest only deals directly with the first two interpretations.

    You should select the Word Count checkbox if the count is to be interpreted as the number of 16-bit words to be transferred. You should leave the Word Count checkbox unselected if the count is to be interpreted as the number of values to be transferred.

These three options (Little-endian, Word-registers, and Word-count) allow 8 possible variations of 32/64-bit value handling. At least 5 of these variations have actually been used in devices, so you may need to carefully read documentation, or to experiment, to determine which variation a particular device uses. The default settings (all options deselected) should work with Enron/Daniel devices. For Modicon/Schneider devices you will probably need to select all the options.