zoukankan      html  css  js  c++  java
  • C# NModbus4实现PLC数据获取(参考HslCommunication)

    modbus tcp server 工具

    modbus tcp client 工具

    自己花用NModbus4重写的工具

      

    modbus 协议

    读取

    bool
    [调试] 2021-04-27 09:34:57.940 Thread [009] ModbusTcpServer[502] : Tcp 接收:00 00 00 00 00 06 01 01 00 63 00 01
    [调试] 2021-04-27 09:34:57.940 Thread [009] ModbusTcpServer[502] : Tcp 发送:00 00 00 00 00 04 01 01 01 00

    short
    [调试] 2021-04-27 09:33:23.307 Thread [013] ModbusTcpServer[502] : Tcp 接收:00 00 00 00 00 06 01 03 00 63 00 01
    [调试] 2021-04-27 09:33:23.307 Thread [013] ModbusTcpServer[502] : Tcp 发送:00 00 00 00 00 05 01 03 02 00 00

    int
    [调试] 2021-04-27 09:33:52.148 Thread [013] ModbusTcpServer[502] : Tcp 接收:00 00 00 00 00 06 01 03 00 63 00 02
    [调试] 2021-04-27 09:33:52.148 Thread [013] ModbusTcpServer[502] : Tcp 发送:00 00 00 00 00 07 01 03 04 00 00 00 01

    float
    [调试] 2021-04-27 09:34:29.733 Thread [013] ModbusTcpServer[502] : Tcp 接收:00 00 00 00 00 06 01 03 00 63 00 02
    [调试] 2021-04-27 09:34:29.733 Thread [013] ModbusTcpServer[502] : Tcp 发送:00 00 00 00 00 07 01 03 04 00 00 00 01

    long
    [调试] 2021-04-28 15:41:46.049 Thread [008] ModbusTcpServer[502] : Tcp 接收:00 09 00 00 00 06 01 03 00 64 00 04
    [调试] 2021-04-28 15:41:46.049 Thread [008] ModbusTcpServer[502] : Tcp 发送:00 09 00 00 00 0B 01 03 08 3F 80 00 00 00 00 00 00

    double
    [调试] 2021-04-28 15:42:12.893 Thread [009] ModbusTcpServer[502] : Tcp 接收:00 0B 00 00 00 06 01 03 00 64 00 04
    [调试] 2021-04-28 15:42:12.893 Thread [009] ModbusTcpServer[502] : Tcp 发送:00 0B 00 00 00 0B 01 03 08 3F 80 00 00 00 00 00 00


    写入

    bool
    [调试] 2021-04-28 15:43:27.742 Thread [008] ModbusTcpServer[502] : Tcp 接收:00 00 00 00 00 06 01 05 00 64 FF 00
    [调试] 2021-04-28 15:43:27.742 Thread [008] ModbusTcpServer[502] : Tcp 发送:00 00 00 00 00 06 01 05 00 64 FF 00

    short
    [调试] 2021-04-28 15:44:05.406 Thread [003] ModbusTcpServer[502] : Tcp 接收:00 02 00 00 00 06 01 06 00 64 00 01
    [调试] 2021-04-28 15:44:05.406 Thread [003] ModbusTcpServer[502] : Tcp 发送:00 02 00 00 00 06 01 06 00 64 00 01

    int
    [调试] 2021-04-28 15:44:24.557 Thread [003] ModbusTcpServer[502] : Tcp 接收:00 03 00 00 00 0B 01 10 00 64 00 02 04 00 00 00 01
    [调试] 2021-04-28 15:44:24.558 Thread [003] ModbusTcpServer[502] : Tcp 发送:00 03 00 00 00 06 01 10 00 64 00 02

    float
    [调试] 2021-04-28 15:44:45.854 Thread [003] ModbusTcpServer[502] : Tcp 接收:00 04 00 00 00 0B 01 10 00 64 00 02 04 3F 80 00 00
    [调试] 2021-04-28 15:44:45.854 Thread [003] ModbusTcpServer[502] : Tcp 发送:00 04 00 00 00 06 01 10 00 64 00 02

    long
    [调试] 2021-04-28 15:45:37.896 Thread [006] ModbusTcpServer[502] : Tcp 接收:00 06 00 00 00 0F 01 10 00 64 00 04 08 00 00 00 00 00 00 00 01
    [调试] 2021-04-28 15:45:37.896 Thread [006] ModbusTcpServer[502] : Tcp 发送:00 06 00 00 00 06 01 10 00 64 00 04

    double
    [调试] 2021-04-28 15:45:07.224 Thread [003] ModbusTcpServer[502] : Tcp 接收:00 05 00 00 00 0F 01 10 00 64 00 04 08 3F F0 00 00 00 00 00 00
    [调试] 2021-04-28 15:45:07.224 Thread [003] ModbusTcpServer[502] : Tcp 发送:00 05 00 00 00 06 01 10 00 64 00 04

    bool 读写测试

     short 读写测试

    int 读写测试

    float 读写测试

    double 读写测试

    long 读写测试

    int, float 涉及传输顺序,必须按照相同的传输顺序进行传送和解析,否则会造成数据错误

     

    ModBusTcpServer 与 ModBusTcpClient

    qq:505645074
  • 相关阅读:
    RTB业务知识2-Open-RTB全景
    常见的选择<数据源协议,委托协议>(IOS发展)
    PHP高级编程SPL
    matlab 基础知识class < superclass_name
    Codeforces Round #FF (Div. 2)
    HDU 5063 Operation the Sequence
    新版本MenuDemo——使用Duilib模拟Windows本机菜单
    Codeforces 458A Golden System
    Arcgis for Javascript实现图
    [Angular2Fire] Firebase auth (Google, Github)
  • 原文地址:https://www.cnblogs.com/chen1880/p/14714441.html
Copyright © 2011-2022 走看看