maskWrite
R2026bPerform mask write operation on a holding register
Syntax
Description
maskWrite(
sets or clears individual bits in a holding register at specified
modbusClientObj,address,andMask,orMask)address on the Modbus server connected to the client
specified by modbusClientObj. The function performs a
read/modify/write operation using a combination of andMask,
orMask, and the current contents of the register.
Examples
Input Arguments
Tips
The function algorithm works as follows:
Result = (register value AND andMask) OR (orMask AND (NOT andMask))
For example:
Hex Binary Current contents 12 0001 0010 And_Mask F2 1111 0010 Or_Mask 25 0010 0101 (NOT And_Mask) 0D 0000 1101 Result 17 0001 0111
If the orMask value is 0, the result is simply the logical ANDing of the current contents and the andMask. If the andMask value is 0, the result is equal to the orMask value.