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

Method writeSingleRegister

src/ModbusMaster.cpp:445–452  ·  view source on GitHub ↗

Modbus function 0x06 Write Single Register. This function code is used to write a single holding register in a remote device. The request specifies the address of the register to be written. Registers are addressed starting at zero. @param u16WriteAddress address of the holding register (0x0000..0xFFFF) @param u16WriteValue value to be written to holding register (0x0000..0xFFFF) @return 0 on

Source from the content-addressed store, hash-verified

443@ingroup register
444*/
445uint8_t ModbusMaster::writeSingleRegister(uint16_t u16WriteAddress,
446 uint16_t u16WriteValue)
447{
448 _u16WriteAddress = u16WriteAddress;
449 _u16WriteQty = 0;
450 _u16TransmitBuffer[0] = u16WriteValue;
451 return ModbusMasterTransaction(ku8MBWriteSingleRegister);
452}
453
454
455/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected