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 multiple 16-bit holding registers on a Modbus slave.

Prototype

CPU_INT16U  MBM_FC16_HoldingRegWrN (MODBUS_CH  *pch, 
                                    CPU_INT08U  slave_node,
                                    CPU_INT16U  slave_addr,
                                    CPU_INT16U *p_reg_tbl,
                                    CPU_INT16U  nbr_reg);

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.

...

specifies the number of registers you want to change. Of course the array pointed to by p_reg_tbl must contain the corresponding number of values.

Returned Value

MODBUS_ERR_NONE

If the call was successful.

...

If the expected number of bytes to receive doesn't correspond to the number of bytes received.

Notes / Warnings

None

Called By

Your Modbus master application.