User 32-bit bit register and user bit masking – Emerson FM-3 User Manual
Page 83
69
Setting Up Parameters
User 32-bit Bit Register and User Bit Masking
When using different communications protocols (i.e. DeviceNet, Profibus, Modbus), it is
often desirable to access groups of User Bits in a single parameter, rather than having to
access them individually. In the FM-3 module it is possible to access 32 User Bits in a single
parameter. This parameter is named BitRegister.#.Value. Because some of the 32 User Bits
may be used by the program, and should not be modified from the network communications,
it is possible to “Mask Off” certain bits. Masking bits prevents them from being modified in
the program when the 32-bit parameter is written to.
When a User Bit Register (group of 32 User Bits) is written to, the value is then logic-AND’ed
with the mask to determine the resulting state of each of the 32 individual bits. If the
individual bit value of the 32-bit mask is “1”, then the corresponding bit from the written 32-
bit parameter is passed through, and the resulting value stored in the specific bit will be the
written bit value. If the bit value of the 32-bit mask is “0”, then that particular bit is blocked
(or masked), and the resulting bit value does not change, (Original Value AND NOT 32-Bit
Mask) or (Value Written over Network AND 32-Bit Mask). An example of this is shown
below.
Figure 42:
Writing to the User Bit Register
The Mask is only used when WRITING to the 32-bit parameter, BitRegister.#.Value. When
reading the 32-bit value, all bits are read regardless of the mask.
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
0
15
Bit #31
0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0
1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 0
Original
Value
Value written
over network
32-bit Mask
Result stored
in each bit