Modbus Configuration


Detailed Description

Most modules in the protocol stack are completly optional and can be excluded. This is specially important if target resources are very small and program memory space should be saved.

All of these settings are available in the file mbconfig.h


Defines

#define MB_ASCII_ENABLED   ( 1 )
#define MB_RTU_ENABLED   ( 1 )
#define MB_TCP_ENABLED   ( 0 )
#define MB_ASCII_TIMEOUT_SEC   ( 1 )
#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS   ( 0 )
#define MB_FUNC_HANDLERS_MAX   ( 16 )
#define MB_FUNC_OTHER_REP_SLAVEID_BUF   ( 32 )
#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED   ( 1 )
#define MB_FUNC_READ_INPUT_ENABLED   ( 1 )
#define MB_FUNC_READ_HOLDING_ENABLED   ( 1 )
#define MB_FUNC_WRITE_HOLDING_ENABLED   ( 1 )
#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED   ( 1 )
#define MB_FUNC_READ_COILS_ENABLED   ( 1 )
#define MB_FUNC_WRITE_COIL_ENABLED   ( 1 )
#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED   ( 1 )
#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED   ( 1 )
#define MB_FUNC_READWRITE_HOLDING_ENABLED   ( 1 )


Define Documentation

#define MB_ASCII_ENABLED   ( 1 )
 

If Modbus ASCII support is enabled.

#define MB_ASCII_TIMEOUT_SEC   ( 1 )
 

The character timeout value for Modbus ASCII.

The character timeout value is not fixed for Modbus ASCII and is therefore a configuration option. It should be set to the maximum expected delay time of the network.

#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS   ( 0 )
 

Timeout to wait in ASCII prior to enabling transmitter.

If defined the function calls vMBPortSerialDelay with the argument MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS to allow for a delay before the serial transmitter is enabled. This is required because some targets are so fast that there is no time between receiving and transmitting the frame. If the master is to slow with enabling its receiver then he will not receive the response correctly.

#define MB_FUNC_HANDLERS_MAX   ( 16 )
 

Maximum number of Modbus functions codes the protocol stack should support.

The maximum number of supported Modbus functions must be greater than the sum of all enabled functions in this file and custom function handlers. If set to small adding more functions will fail.

#define MB_FUNC_OTHER_REP_SLAVEID_BUF   ( 32 )
 

Number of bytes which should be allocated for the Report Slave ID command.

This number limits the maximum size of the additional segment in the report slave id function. See eMBSetSlaveID( ) for more information on how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED is set to 1.

#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED   ( 1 )
 

If the Report Slave ID function should be enabled.

#define MB_FUNC_READ_COILS_ENABLED   ( 1 )
 

If the Read Coils function should be enabled.

#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED   ( 1 )
 

If the Read Discrete Inputs function should be enabled.

#define MB_FUNC_READ_HOLDING_ENABLED   ( 1 )
 

If the Read Holding Registers function should be enabled.

#define MB_FUNC_READ_INPUT_ENABLED   ( 1 )
 

If the Read Input Registers function should be enabled.

#define MB_FUNC_READWRITE_HOLDING_ENABLED   ( 1 )
 

If the Read/Write Multiple Registers function should be enabled.

#define MB_FUNC_WRITE_COIL_ENABLED   ( 1 )
 

If the Write Coils function should be enabled.

#define MB_FUNC_WRITE_HOLDING_ENABLED   ( 1 )
 

If the Write Single Register function should be enabled.

#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED   ( 1 )
 

If the Write Multiple Coils function should be enabled.

#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED   ( 1 )
 

If the Write Multiple registers function should be enabled.

#define MB_RTU_ENABLED   ( 1 )
 

If Modbus RTU support is enabled.

#define MB_TCP_ENABLED   ( 0 )
 

If Modbus TCP support is enabled.


Automatically generated by Doxygen 1.4.2 on 13 Sep 2018.