MCPcopy Create free account
hub / github.com/4-20ma/ModbusMaster / maskWriteRegister

Method maskWriteRegister

src/ModbusMaster.cpp:537–544  ·  view source on GitHub ↗

Modbus function 0x16 Mask Write Register. This function code is used to modify the contents of a specified holding register using a combination of an AND mask, an OR mask, and the register's current contents. The function can be used to set or clear individual bits in the register. The request specifies the holding register to be written, the data to be used as the AND mask, and the data to

Source from the content-addressed store, hash-verified

535@ingroup register
536*/
537uint8_t ModbusMaster::maskWriteRegister(uint16_t u16WriteAddress,
538 uint16_t u16AndMask, uint16_t u16OrMask)
539{
540 _u16WriteAddress = u16WriteAddress;
541 _u16TransmitBuffer[0] = u16AndMask;
542 _u16TransmitBuffer[1] = u16OrMask;
543 return ModbusMasterTransaction(ku8MBMaskWriteRegister);
544}
545
546
547/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected