Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This function is called from YOUR application code to write to a single coil on a Modbus slave.

Prototype

CPU_INT16U  MBM_FC05_CoilWr (MODBUS_CH  *pch, 
                             CPU_INT08U  slave_node,
                             CPU_INT16U  slave_addr,
                             CPU_BOOLEAN coil_val);

Arguments

pch

is a pointer to the channel (returned by MB_CfgCh()). This pointer specifies onto which channel the Modbus master will be communicating on. Of course, ‘pch’ must have been configured as a Master when you configured the channel.

...

is the desired value of the coil and can be either: MODBUS_COIL_OFF or MODBUS_COIL_ON.

Returned Value

MODBUS_ERR_NONE

if the call was successful.

...

If you specified an invalid coil address.

Notes / Warnings

None

Called By

Your Modbus master application.