Modbus TCP Client Read Map Edit
Modbus TCP Client Read Maps are where you configure this device to query other Modbus TCP devices for data, and store that data in local data objects. This page is where you enter the various parameters to make that happen.
Map Number – Used as a reference in the map list for ordering the maps. Polling is done in round robin fashion in the order of map number.
The appearance of the following line will vary depending on your user settings. You have the option of displaying Modbus registers as raw address (0-indexed), register number (1-indexed), or Modicon format (e.g. 40001 style).
The following variations all refer to exactly the same register:
Click the Check to validate a Modicon number.
The options available on this line will vary depending on selections made. The following are a few examples.
Register Type – Modbus register types available are listed in the following table. These labels are illustrated here as recognized in XML or CSV files, but are further annotated on the web page.
|Label||Modbus Register type|
|“none”||No register defined|
Register Number or Address – Enter the number (starting at 1) or raw address (starting at 0) as applicable. Do NOT enter 40001 for holding register 1 if you have not selected Modicon as the display format in your User Settings.
Modicon Register – Enter numbers like 40001 for the first holding register if you have selected Modicon representation in your User Settings.
Register Format – Select the format of the data contained in the Modbus register(s). This is not used by the protocol, but is used by the gateway to interpret what the raw increments of 1 or 16 bits should mean. Select format from the following table.
|Format Label||Format description|
|“None”||No format defined|
|“Bit”||Single bit, used ONLY for Register Type Coil or Disc|
|“Int”||Integer (size and whether signed are defined by labels below)|
|“Real”||Floating point (single or double precision)|
|“Char”||Character string with 2 ASCII characters per register|
|“Mod10”||Mod10 format, can be 2, 3, or 4-register, specific to Schneider Electric meters|
Register Size – Register size refers to the number of consecutive input or holding registers that should be read for a value greater than 16 bits. A 16-bit value would have size of 1, a 32-bit value would have size of 2, and a 64-bit value would have size of 4. Single precision Real (32-bit IEEE 754 floating point) would be size 2, and double precision Real (64-bit IEEE 754 floating point) would be size 4. If format is Mod10, then valid sizes are 2, 3, or 4 – check manufacturer’s documentation if Mod10 is noted. Register “size” for a character string will be character count divided by 2 (plus 1 of string length is an odd number). Register Size is not used for Coil or Disc types.
Unsigned – Select signed or unsigned. Defaults to signed integer. Has no effect on Register Format other than Int.
Endian Selection – Used when Register Size is greater than 1 to indicate what order the registers should be interpreted in. Select "low" to indicate that the lowest numbered register contains the least significant portion of data. Select "high" to indicate that the lowest numbered register contains the most significant portion of data. Although Modbus protocol itself is not inherently “Little Endian”, many devices operate that way due to Intel processors being inherently Little Endian. Modbus protocol does not stipulate what the register order should be when multiple registers are treated as a single data entity. Therefore, the user is required to pay attention to this.
Device – Select a device from the TCP Device list that should be accessed for this read attempt on a TCP network.
Unit – Unit number to be included in the TCP request, will default to 1 if not given or is set to zero. Web page will force it to default to 1, but is optional for CSV or XML import.
Mask – A bit mask given as an 8-digit hexadecimal value, if non-zero. The mask operation is skipped if mask value is zero, or register format is not Int (integer). When the data of interest is a single bit, or bit field less than the full register width, the Mask is used. When the Modbus register is read, its data is bit-wise ANDed with the Mask, then right justified so that the least significant mask bit becomes the least significant data bit. The result is then placed in the local data object selected by the read map.
Scale – Register content is multiplied by this value, if non-zero, before being placed into the local object. Scale is treated mathematically as 1 if omitted (set to zero).
Offset – This value is added to the register content (after being multiplied by scale) before being placed into the local object.
NOTE: The order of operation is as follows: (1) read Modbus register; (2) apply mask if applicable; (3) apply scale if non-zero; (4) apply offset. Result is then placed in local object.
Poll Time – Poll time in seconds (can be fractional). The sets the rate at which the remote Modbus register will be read. This poll time is not guaranteed to be met. Polling is done in round-robin fashion. In a very busy system, more than this time may expire before the next poll. If less than this time has expired, then the system will wait this amount of time until polling again.
Local Object – Local object number that the result of the Modbus read operation should be placed into.
Default Value – Provides the default value that the local object should be set to in the event the FailCount is exceeded.
Fail Count – Optional, provides a count of read failures, if non-zero, that can occur before the local object will be set to the default value given in this map. If zero, the default value will never be applied. If 1, then the default value will be applied upon the first failure (probably not recommended), and so on. The count is reset by a successful read.
Index Object – Optional, allows for selectively enabling this read operation. If an index object (local object number) is given, and its value matches the index value, then this read operation will take place. If an index object is given but the local object’s value does not match the index value, then this read operation will be skipped.
Index Value – Optional, used in conjunction with Index Object (see note above).
To illustrate the use of Mask, consider the two following read maps. Note that they are reading the same register from the remote Modbus device. But the mask value is different.
The value derived from the first read map will be an 8-bit value taken from the low order byte of the 16-bit holding register. The value derived from the second read map will be an 8-bit value taken from the high order byte of the 16-bit holding register. This is how you "unpack" values from a packed Modbus register.
Another common requirement is to pick single bits out of a holding register. For a single bit, the Mask value will be a single bit like 00000001, 00000002, 00000004, 00000008, etc.
If the maps such as the two illustrated above are placed in sequential order in the read map list, they will result in only a single Modbus read request, and the data will be shared with all sequential maps requesting the same register from the same device.