为什么引入zero_mode,为什么默认为False?

时间:2019-04-09 07:22:02

标签: python modbus pymodbus

我不知道为什么pymodbus需要zero_mode参数?有用例吗?似乎通常我们想要得到我们设定的东西。

ModbusSequentialDataBlock(0, [1, 2, 3, 4]))
# And we expect get [1, 2, 3, 4] when 
client.read_holding_registers(0, 4)

-

# The slave context can also be initialized in zero_mode which means that a
# request to address(0-7) will map to the address (0-7). The default is
# False which is based on section 4.4 of the specification, so address(0-7)
# will map to (1-8)::
#
#     store = ModbusSlaveContext(..., zero_mode=True)
#---------------------------------------------------------------------------# 
store = ModbusSlaveContext(
    di = ModbusSequentialDataBlock(0, [17]*100),
    co = ModbusSequentialDataBlock(0, [17]*100),
    hr = ModbusSequentialDataBlock(0, [17]*100),
    ir = ModbusSequentialDataBlock(0, [17]*100))

任何人都可以共享链接,规范的4.4节在哪里? https://pymodbus.readthedocs.io/en/v1.3.2/examples/synchronous-server.html?highlight=zero_mode

0 个答案:

没有答案
相关问题