{
  "$schema": "https://raw.githubusercontent.com/nobrega8/mbmap-library/main/schema/mbmap-2.schema.json",
  "mbmap": 2,
  "vendor": "Treetech",
  "model": "DM",
  "models": [
    "DM",
    "DMX"
  ],
  "vendor_website": "treetech.com.br",
  "description": "Digital input module with 8, 16 or 24 inputs: input states, memory buffer and active period counters",
  "revision": 1,
  "revised": "2026-11-10",
  "firmware": "3.2",
  "source": "Treetech DM Communication Protocol Map MAP-011, rev. 1.10",
  "sources": [
    {
      "title": "DM - Data Acquisition and Control Module: Communication Protocol Map (MAP-011)",
      "version": "1.10",
      "date": "2022-11-16",
      "url": "https://sac.treetech.com.br/helpdesk/attachments/69130817417",
      "note": "section 2 (Modbus); linked in issue #154"
    }
  ],
  "notes": [
    "Modbus RTU on RS-485, FC03 (read) and FC06 and FC16 (write) only. Addresses are 0-based, as sent on the wire. Every register is a holding register, including the input states.",
    "The document gives fixed serial settings of 9600 bit/s, 8 data bits, no parity and 2 stop bits. It gives no slave address; 1 is assumed here.",
    "The linked document is titled DM (Data Acquisition and Control Module) and covers the DM1, DM2 and DM3 versions with 8, 16 or 24 digital inputs (Y1 to Y24). It was requested as DMX.",
    "Input states and the memory buffer are bit fields, one entry per bit. The document leaves the register numbers of the last five rows (firmware version and release, and the three buffer reset commands) blank, so they are not in this map.",
    "The document was written for firmware 3.2. Written from that document; this map has not been tested on a device."
  ],
  "protocol": "rtu",
  "unit_id": 1,
  "baudrate": 9600,
  "parity": "N",
  "databits": 8,
  "stopbits": 2,
  "byte_order": "big",
  "word_order": "big",
  "address_base": 0,
  "x_status": "official",
  "enums": {
    "triggered": {"0": "Not triggered", "1": "Triggered"},
    "present": {"0": "Absent", "1": "Present"},
    "yesno": {"0": "No", "1": "Yes"}
  },
  "registers": [
    {"name": "product version DM1", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "yesno", "bit": 0},
    {"name": "product version DM2", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "yesno", "bit": 1},
    {"name": "product version DM3", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "yesno", "bit": 2},
    {"name": "master board present (Y1 to Y8)", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "present", "bit": 3, "description": "8-input module"},
    {"name": "slave board 1 present (Y9 to Y16)", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "present", "bit": 4, "description": "16-input module"},
    {"name": "slave board 2 present (Y17 to Y24)", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "present", "bit": 5, "description": "24-input module"},
    {"name": "slave board 1 internal failure", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "slave board 2 internal failure", "group": "Inputs", "area": "holding", "address": 0, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "input Y1", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "input Y2", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "input Y3", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "input Y4", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "input Y5", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "input Y6", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "input Y7", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "input Y8", "group": "Inputs", "area": "holding", "address": 1, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "input Y9", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "input Y10", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "input Y11", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "input Y12", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "input Y13", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "input Y14", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "input Y15", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "input Y16", "group": "Inputs", "area": "holding", "address": 2, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "input Y17", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "input Y18", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "input Y19", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "input Y20", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "input Y21", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "input Y22", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "input Y23", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "input Y24", "group": "Inputs", "area": "holding", "address": 3, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "Input Y1 active period", "group": "Active period counters", "area": "holding", "address": 4, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y2 active period", "group": "Active period counters", "area": "holding", "address": 5, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y3 active period", "group": "Active period counters", "area": "holding", "address": 6, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y4 active period", "group": "Active period counters", "area": "holding", "address": 7, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y5 active period", "group": "Active period counters", "area": "holding", "address": 8, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y6 active period", "group": "Active period counters", "area": "holding", "address": 9, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y7 active period", "group": "Active period counters", "area": "holding", "address": 10, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y8 active period", "group": "Active period counters", "area": "holding", "address": 11, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y9 active period", "group": "Active period counters", "area": "holding", "address": 12, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y10 active period", "group": "Active period counters", "area": "holding", "address": 13, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y11 active period", "group": "Active period counters", "area": "holding", "address": 14, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y12 active period", "group": "Active period counters", "area": "holding", "address": 15, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y13 active period", "group": "Active period counters", "area": "holding", "address": 16, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y14 active period", "group": "Active period counters", "area": "holding", "address": 17, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y15 active period", "group": "Active period counters", "area": "holding", "address": 18, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y16 active period", "group": "Active period counters", "area": "holding", "address": 19, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y17 active period", "group": "Active period counters", "area": "holding", "address": 20, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y18 active period", "group": "Active period counters", "area": "holding", "address": 21, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y19 active period", "group": "Active period counters", "area": "holding", "address": 22, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y20 active period", "group": "Active period counters", "area": "holding", "address": 23, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y21 active period", "group": "Active period counters", "area": "holding", "address": 24, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y22 active period", "group": "Active period counters", "area": "holding", "address": 25, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y23 active period", "group": "Active period counters", "area": "holding", "address": 26, "type": "uint16", "unit": "cycles"},
    {"name": "Input Y24 active period", "group": "Active period counters", "area": "holding", "address": 27, "type": "uint16", "unit": "cycles"},
    {"name": "Active period cycle duration", "group": "Active period counters", "area": "holding", "address": 28, "type": "uint16", "unit": "ms", "access": "RW", "write_min": 10, "write_max": 65535, "description": "Length of one cycle used to count the active period"},
    {"name": "Active period start delay", "group": "Active period counters", "area": "holding", "address": 29, "type": "uint16", "unit": "ms", "access": "RW", "write_min": 10, "write_max": 65535, "description": "Delay before the counting starts"},
    {"name": "Memory: product version DM1", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "yesno", "bit": 0},
    {"name": "Memory: product version DM2", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "yesno", "bit": 1},
    {"name": "Memory: product version DM3", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "yesno", "bit": 2},
    {"name": "Memory: master board present (Y1 to Y8)", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "present", "bit": 3, "description": "8-input module"},
    {"name": "Memory: slave board 1 present (Y9 to Y16)", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "present", "bit": 4, "description": "16-input module"},
    {"name": "Memory: slave board 2 present (Y17 to Y24)", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "present", "bit": 5, "description": "24-input module"},
    {"name": "Memory: slave board 1 internal failure", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "Memory: slave board 2 internal failure", "group": "Input memory buffer", "area": "holding", "address": 30, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "Memory: input Y1", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "Memory: input Y2", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "Memory: input Y3", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "Memory: input Y4", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "Memory: input Y5", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "Memory: input Y6", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "Memory: input Y7", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "Memory: input Y8", "group": "Input memory buffer", "area": "holding", "address": 31, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "Memory: input Y9", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "Memory: input Y10", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "Memory: input Y11", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "Memory: input Y12", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "Memory: input Y13", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "Memory: input Y14", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "Memory: input Y15", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "Memory: input Y16", "group": "Input memory buffer", "area": "holding", "address": 32, "type": "bool", "enum": "triggered", "bit": 7},
    {"name": "Memory: input Y17", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 0},
    {"name": "Memory: input Y18", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 1},
    {"name": "Memory: input Y19", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 2},
    {"name": "Memory: input Y20", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 3},
    {"name": "Memory: input Y21", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 4},
    {"name": "Memory: input Y22", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 5},
    {"name": "Memory: input Y23", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 6},
    {"name": "Memory: input Y24", "group": "Input memory buffer", "area": "holding", "address": 33, "type": "bool", "enum": "triggered", "bit": 7}
  ]
}
