Modbus 协议配置

Modbus Configuration

Modbus配置 

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

协议栈中大多数模块是可选的并且可以被包含。这对于目标资源有限的应用非常重要,在这种应用中,需要节省程序存储空间。

所有的这些设置都在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_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.

Modbus ASCII 协议支持

 

#define MB_ASCII_TIMEOUT_SEC   ( 1 )

 

 

 

The character timeout value for Modbus ASCII.

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.

Modbus ASCII协议中的字符超时时间不是一个固定值,因此是一个可以配置的值。这个值可设置为网络中的最大的延迟时间。

 

#define MB_FUNC_HANDLERS_MAX   ( 16 )

 

 

 

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

Modbus协议栈支持的功能码的最多值

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.

Report Slave ID命令分配的字节数目

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.

这个数值限制了在执行report slave ID时候附加信息的长度。参考eMBSetSlaveID( )获取信息来确定需要如何设置这个值。

 

#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED   ( 1 )

 

 

 

If the Report Slave ID function should be enabled.

Report Slave ID 功能使能

 

#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.

Modbus RTU支持使能

 

#define MB_TCP_ENABLED   ( 0 )

 

 

 

If Modbus TCP support is enabled.

Modbus TCP支持使能

 

#define 

MB_ASCII_ENABLED   ( 1 )

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值