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

Method writeSingleCoil

src/ModbusMaster.cpp:425–430  ·  view source on GitHub ↗

Modbus function 0x05 Write Single Coil. This function code is used to write a single output to either ON or OFF in a remote device. The requested ON/OFF state is specified by a constant in the state field. A non-zero value requests the output to be ON and a value of 0 requests it to be OFF. The request specifies the address of the coil to be forced. Coils are addressed starting at zero. @par

Source from the content-addressed store, hash-verified

423@ingroup discrete
424*/
425uint8_t ModbusMaster::writeSingleCoil(uint16_t u16WriteAddress, uint8_t u8State)
426{
427 _u16WriteAddress = u16WriteAddress;
428 _u16WriteQty = (u8State ? 0xFF00 : 0x0000);
429 return ModbusMasterTransaction(ku8MBWriteSingleCoil);
430}
431
432
433/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected