PROTOCOL-SPECIFIC INFORMATION
9.1.3 Coil & Discrete Input Mappings
The Modbus/TCP driver provides read/write support for coils (0X references) and read-only support for
discrete inputs (1X references). These will collectively be referred to from here on out as simply
“discretes”. Accessing discretes does not reference any new physical data: discretes are simply indexes
into various bits of existing registers. What this means is that when a discrete is accessed, that discrete
is resolved by the interface into a specific register, and a specific bit within that register. The pattern of
discrete-to-register/bit relationships can be described as follows:
Discrete 1...16 map to register #1, bit0...bit15 (bit0=LSB, bit15=MSB)
Discrete 17...32 map to register #2, bit0...bit15, and so on.
Arithmetically, the discrete-to-register/bit relationship can be described as follows: For any given
discrete, the register in which that discrete resides can be determined by:
+
=
16
15discrete
register
Equation 1
Where the bracket symbols “ ” indicate the “floor” function, which means that any fractional result (or
“remainder”) is to be discarded, with only the integer value being retained.
Also, for any given discrete, the targeted bit in the register in which that discrete resides can be
determined by:
Equation 2