• Libraries
  • Shop
  • Doc
  • Free Modbus
  • Support
  • Login
FieldTalk Modbus Master Library for .NET
FieldTalk Modbus Master Library for .NET
Namespaces
FieldTalk.Modbus.Master
MbusMasterFunctions Class
MbusMasterFunctions Methods
closeProtocol Method
configureBigEndianInts Method
configureCountFromOne Method
configureCountFromZero Method
configureEnron32BitMode Method
configureIeeeFloats Method
configureLittleEndianInts Method
configureStandard32BitMode Method
configureSwappedFloats Method
customFunction Method
Dispose Method
forceMultipleCoils Method
getPackageVersion Method
getPollDelay Method
getRetryCnt Method
getSuccessCounter Method
getTimeout Method
getTotalCounter Method
isOpen Method
maskWriteRegister Method
readCoils Method
readDeviceIdentification Method
readExceptionStatus Method
readFileRecord Method
readInputDiscretes Method
readInputMod10000 Method
readInputRegisters Method
readMultipleMod10000 Method
readMultipleRegisters Method
readWriteRegisters Method
resetSuccessCounter Method
resetTotalCounter Method
restartCommunicationsOption Method
returnQueryData Method
setPollDelay Method
setRetryCnt Method
setTimeout Method
writeCoil Method
writeFileRecord Method
writeMultipleMod10000 Method
writeMultipleRegisters Method
writeSingleRegister Method
Click or drag to resizeClick or drag to resize

MbusMasterFunctionsmaskWriteRegister Method

Modbus function 22 (16 hex), Mask Write Register.

Namespace:  FieldTalk.Modbus.Master
Assembly:  FieldTalk.Modbus.Master (in FieldTalk.Modbus.Master.dll) Version: 2.15.2-eval+3d8362b4bb861c05760d48b11d303e954bb8597c
Syntax
C#
VB
C++
Copy
public int maskWriteRegister(
	int slaveAddr,
	int regAddr,
	short andMask,
	short orMask
)
Public Function maskWriteRegister ( 
	slaveAddr As Integer,
	regAddr As Integer,
	andMask As Short,
	orMask As Short
) As Integer
public:
int maskWriteRegister(
	int slaveAddr, 
	int regAddr, 
	short andMask, 
	short orMask
)

Parameters

slaveAddr
Type: SystemInt32
Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr
Type: SystemInt32
Register address (Range: 1 - 65536)
andMask
Type: SystemInt16
Mask to be applied as a logic AND to the register
orMask
Type: SystemInt16
Mask to be applied as a logic OR to the register

Return Value

Type: Int32
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors for possible error codes.
Remarks
Masks bits according to an AND and an OR mask into a single output register (holding register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND andMask) OR (orMask AND (NOT andMask))
Note Note
No broadcast supported
See Also

Reference

MbusMasterFunctions Class
FieldTalk.Modbus.Master Namespace
FieldTalk Modbus Master Library for .NET
Library version 2.15.2
Speak to the Experts
Modbus Organization Member logo

We are member of the Modbus Organization, Inc.

Buy with Confidence
30-day money back guarantee All our FieldTalk web sales are backed by a 30-day Money Back Guarantee.
We Accept
Bank VISA MasterCard PayPal
Customer Info
  • Info & Contact
  • Customer Login
  • Terms of Service
  • Terms of Sale
  • Privacy Policy
© 2005-2025 proconX Pty Ltd. All rights reserved. proconX and FieldTalk are trademarks of proconX Pty Ltd.
All other trademarks and registered trademarks appearing on www.modbusdriver.com are the property of their respective owners.