• 批注:modbus_tkdefines.py


    批注:modbus_tkdefines.py(1.1.2)
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    """
     Modbus TestKit: Implementation of Modbus protocol in python
    
     (C)2009 - Luc Jean - luc.jean@gmail.com
     (C)2009 - Apidev - http://www.apidev.fr
    
     This is distributed under GNU LGPL license, see license.txt
    """
    
    #modbus exception codes
    ILLEGAL_FUNCTION = 1
    ILLEGAL_DATA_ADDRESS = 2
    ILLEGAL_DATA_VALUE = 3
    SLAVE_DEVICE_FAILURE = 4
    COMMAND_ACKNOWLEDGE = 5
    SLAVE_DEVICE_BUSY = 6
    MEMORY_PARITY_ERROR = 8
    
    #supported modbus functions
    READ_COILS = 1
    READ_DISCRETE_INPUTS = 2
    READ_HOLDING_REGISTERS = 3
    READ_INPUT_REGISTERS = 4
    WRITE_SINGLE_COIL = 5
    WRITE_SINGLE_REGISTER = 6
    READ_EXCEPTION_STATUS = 7
    DIAGNOSTIC = 8
    REPORT_SLAVE_ID = 17
    WRITE_MULTIPLE_COILS = 15
    WRITE_MULTIPLE_REGISTERS = 16
    READ_WRITE_MULTIPLE_REGISTERS = 23
    DEVICE_INFO = 43
    
    #supported block types
    COILS = 1
    DISCRETE_INPUTS = 2
    HOLDING_REGISTERS = 3
    ANALOG_INPUTS = 4
    defines.py(原文)

    第一部分:modbus exception codes:异常代码解释

    如:

    非法函数:1

    非法的u数据u地址:2/

    第二部分:supported modbus functions 支持的寄存器操作功能

    读取线圈:1

    读取离散输入:2

    读取保持寄存器:3

    读取输入寄存器:4

    写入单个线圈:5

    写入单个寄存器:6

    读取异常状态:7

    诊断:8

    报告从机ID:17

    写入多个线圈:15

    写入多个寄存器:16

    读写多个寄存器:23

    设备信息:43

    第三部分:supported block types 支持的块类型

    线圈=1

    离散输入=2

    保持寄存器=3

    模拟输入=4

    python
  • 相关阅读:
    Linux 文件权限
    Linux 查看磁盘使用情况
    绑定到外部验证服务LDAP、配置 autofs
    创建逻辑卷
    查找一个字符串
    查找用户目录下的指定文件
    配置NTP时间服务器
    通过Roslyn构建自己的C#脚本(更新版)(转)
    Elon Musk
    可能改变世界的13个“终结”(上)
  • 原文地址:https://www.cnblogs.com/yongqi-wang/p/15305134.html
Copyright © 2020-2023  润新知