Modbus RTU Master Read Map Edit

From Control Solutions IoTServer Documentation
Revision as of 18:40, 19 April 2019 by Markclark (talk | contribs)
Jump to navigation Jump to search

To create a Modbus RTU Read map, there is a form that needs to be filled in. Here is the page for modifying a Read Map.


Modify RTU Read Map.png


Here is a description for all of the fields that are on this page:

Modify RTU Read Map Type.png - Here you select the register type that needs to be read from the slave device. The Modbus register types supported are: None, Coil, Discrete Input, Input, and Holding registers. Note: Selecting "None" effectively turns off this read rule, but does not delete it.


Modify RTU Read Map SlvAddrs.png - This is the register number / address that is supposed to be read from the slave device. Depending on your user settings, you will either enter the Modbus register address (shown here), Modbus number, or use Modicon notation for this field.


Modify RTU Read Map Format.png - Here you enter the data format and size that should be used for this read. The valid data types are Integer (int), Floating point IEEE 754 format (Real), Character (Char) and Modd10 (mod10). Some of these data types can of options associated with them. Int can be signed or unsigned, and can have a length of 1, 2, or 4 registers long. Real, can be either 2, or 4 registers long.

Notes: - Mod10 has the options of 2, 3, or 4 registers based on the definition of the format, check manufacturer’s documentation if Mod10 is noted. - Char can be upto 63 registers long. Register “size” for a character string will be character count divided by 2 (plus 1 of string length is an odd number). RegSize is not used for Coil or Disc types. - When RegSize is greater than 1 to indicate what order the registers should be interpreted in. Enter “Y” to indicate that the lowest numbered register contains the least significant portion of data. Enter “N” or omit 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.


Modify RTU Read Map Slave.png - This is the slave / unit number of the device you want to retrieve the data from.

Modify RTU Read Map RegOrder.png - If the register length is greater than one, this may be displayed, asking the way the data should be read.


Once a register has been read, additional items, can be performed on the value read. This can be to: extract out a bit, or portion of the data, apply a scale factor, or apply an offset value to the value read, if needed.


Modify RTU Read Map Mask.png - Is used to extract our data from the register. This can be a single bit, all the way up to the entire register. The data entered here needs to be entered in Hexadecimal format. Often Modbus may have each bit in an Unsigned Integer value represent a single status bit. This allows one register to contain sixteen individual values. Another usage of this would be if the 16-bit register actually contained two 8-bit values. One in the lower half of the register, the other in the upper half of the register. See appendix ???? for additional information on bit mask and extracting portions of a register.


Modify RTU Read Map ScaleOffset.png - From that point you can perform scaling and apply an offset to the result if necessary. Scaling applies the formula y=mx+b. When reading from the slave, the raw data is multiplied by the scale factor, then the offset is added to produce the resulting present value. When writing to the slave, the offset is first subtracted from the present value, and that result is divided by the scale factor to produce the raw data actually written to the slave device. NOTE: If a scale factor is not given (zero is entered), no scaling will be performed, as if slope=1 and intercept=0.


Modify RTU Poll Period.png - This sets the rate the point is to be polled from the slave device, and the Modify RTU SaveLocal.png location in this gateway where this data is to be saved (Local Object).

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

RegSize – Register size refers to the number of consecutive input or holding registers 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). RegSize is not used for Coil or Disc types.

Unsigned – Indicate “Y” if unsigned, or “N” if signed. Defaults to signed integer. Has no effect on RegFormat other than Int.

LittleEnd – Used when RegSize is greater than 1 to indicate what order the registers should be interpreted in. Enter “Y” to indicate that the lowest numbered register contains the least significant portion of data. Enter “N” or omit 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.

Mask – A bit mask given as a 4-digit or 8-digit hexadecimal value, if non-zero (Mask operation skipped if mask value is zero, or register format is not Int). 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.

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.

DestObj – (REQUIRED) – Local object number that the result of the Modbus read operation should be placed into.

PollTime – 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.

DefValue – Provides the default value that the local object should be set to in the event the FailCount is exceeded.

FailCount – 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.

IndexObj – Optional, allows for selectively enabling this read operation. If an index object (local object number) is given, and its value matches the IndexVal value, then this read operation will take place. If an IndexObj is given but the local object’s value does not match the IndexVal, then this read operation will be skipped.

IndexVal – Optional, used in conjunction with IndexObj (see note above).