MODBUS

Modbus Configuration files for ESP8266/Arduino

기하 2021. 8. 24. 00:28

Modbus프로토콜로 RS-485를 통해 작동하는

마이크로컨트롤러 ESP8266/ESP32/Arduino를 기반으로한
장치를 개발할 때 중요한 순간은 Modbus 작동의 구성입니다.

(configuration of Modbus operations.)

 

형식의 구성(configuration of the format)에 "바퀴를 재발명"할 이유는 없습니다. 
Description of the Modbus configuration for Microsoft IoT Edge. 에 나오는

JSON을 사용할 것입니다

 

마이크로컨트롤러에서의 JSON 파일은 메모리 제한으로 인해

작업하기가 더 어렵기 때문에 원본 구성 파일이 약간 수정됩니다.

 

  [
  {
    "Slave": {
      "Connection": "ttyS0",
      "RxPin": "15",
      "TxPin": "13",
      "PollingInterval": "2000",
      "RetryCount": "10",
      "RetryInterval": "100",
      "HwId": "TermoSensor-0a:01:01:01:01:02",
      "BaudRate": "9600",
      "Config": "SERIAL_8N1",
      "Ops": [
        {
          "PollingInterval": "2000",
          "UnitId": "1",
          "Function": "0x04",
          "Address": "0x01",
          "Len": "1",
          "DisplayName": "Temp"
        },
        {
          "PollingInterval": "2000",
          "UnitId": "1",
          "Function": "0x04",
          "Address": "0x02",
          "Len": "1",
          "DisplayName": "Humidity"
        }          
      ]
    }
  },
  {
    "Slave": {
      "Connection": "192.168.1.2",
      "TcpPort": "502",
      "PollingInterval": "2000",
      "HwId": "TermoSensor-0a: 01:01:01:01:02",
      "Ops": [
        {
          "PollingInterval": "2000",
          "UnitId": "1",
          "Function": "0x04",
          "Address": "0x01",
          "Len": "1",
          "DisplayName": "Temp"
        }  
      ]
    }
  }
]

Field expansion:

  • "PublishInterval"-Interval between each push to Cloud Server in Millisecond.
  • "Slave"-Contains one or more Modbus slaves ' configuration.
    • "SlaveConnection"-Ipv4 address or the serial port name of the Modbus slave.
    • "RxPin"-Rx pin (e.g. for SoftwareSerial initialization).
    • "TxPin"-Rx pin (e.g. for SoftwareSerial initialization).
    • "RetryCount"-Max retry attempt for reading data, default to 10.
    • "RetryInterval"-Retry interval between each Retry attempt, default to 50 milliseconds
    • "HwId"-Unique Id for each Modbus slave (User Defined).
    • "BaudRate"-Serial port communication parameter. (Valid values:… 9600, 14400.19200…)
    • "Config"-Serial port configuration. Default SERIAL_8N1. Possible values see here.
    • "Ops"-Contains one or more Modbus read requests.
      • "PollingInterval": Interval between each read request in Millisecond.
      • "UnitId"-The unit ID (SlaveID) to be read.
      • "Function"-the number of the function (register) to read the data. Instead of "StartAddress" in the original JSON version.
      • "Address"-the offset of the address in the selected register.
      • "Len"-Number of registers/bits to be read. Instead of "Count" in the original version.
      • "DisplayName"-Operation name.
      • "CorrelationId"-The Operations with the same ID will be grouped together in their output message. (for future releases).

'MODBUS' 카테고리의 다른 글

Modbus TCP/IP  (0) 2021.11.12
완전한 Modbus 가이드  (0) 2021.09.06
Arduino / ESP8266 / ESP32를 위한 저렴한 RS-485 인터페이스  (0) 2021.09.02
Inexpensive RS485 module with ESP32 (software serial)  (0) 2021.09.02
MODBUS Protocol  (0) 2021.08.17