{
  "$schema": "https://raw.githubusercontent.com/nobrega8/mbmap-library/main/schema/mbmap-2.schema.json",
  "mbmap": 2,
  "vendor": "Treetech",
  "model": "DI",
  "models": [
    "DI"
  ],
  "vendor_website": "treetech.com.br",
  "description": "Eight-input digital indicator for analog signals: measurements, two alarm relays per input, analog output, scaling and event log",
  "revision": 1,
  "revised": "2026-11-10",
  "firmware": "1.03",
  "source": "Treetech DI Mapa de Registradores, firmware 1.03",
  "sources": [
    {
      "title": "Mapa de Registradores DI (Indicador Digital), Protocolo MODBUS-RTU",
      "version": "1.00-pt, firmware 1.03",
      "date": "2010-12-28",
      "url": "https://sac.treetech.com.br/helpdesk/attachments/69130814917",
      "note": "section D.1; linked in issue #156"
    }
  ],
  "notes": [
    "Optional Modbus RTU interface on RS-485, FC03, FC06 and FC16. All data is in holding registers (the document calls the memory type 40000). The document numbers registers from 1 (PLC addresses), so the addresses are 1-based (address on the wire = number minus 1).",
    "Baud rate is 9600, 19200 or 38400 bit/s with 8 data bits, no parity and 2 stop bits. The document gives no factory default for the baud rate or the slave address; 9600 and 1 are assumed here.",
    "The device is an eight-input analog indicator. Measurements, alarm values and scale limits are integers from -9999 to 9999 and the number of decimal places of each input (registers 28, 32, 36 ... 56) moves the decimal point, so they are given as raw values.",
    "The status bits in registers 1009 and 1010 are numbered 1, 2, 4 and 2, 4, 5 in the document, which does not say whether bit 0 or bit 1 is the first. They are entered as printed: check them on a device.",
    "Registers 17 and 18 are reserved and not in this map. The document is dated 2010 and the second part is the DNP 3.0 profile, which is not mapped.",
    "Written from the manufacturer's document for firmware 1.03; not 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": 1,
  "x_status": "official",
  "enums": {
    "display": {"0": "Fixed", "1": "Maximum", "2": "Minimum", "3": "Alternating"},
    "common": {"0": "Negative", "1": "Positive"},
    "analog_source": {"0": "Minimum value", "1": "Input 1", "2": "Input 2", "3": "Input 3", "4": "Input 4", "5": "Input 5", "6": "Input 6", "7": "Input 7", "8": "Input 8", "9": "Maximum value"},
    "current_scale": {"0": "-20 to +20 mA", "1": "-10 to +10 mA", "2": "-5 to +5 mA", "3": "-1 to +1 mA", "4": "0 to 1 mA", "5": "0 to 5 mA", "6": "0 to 10 mA", "7": "0 to 20 mA", "8": "4 to 20 mA"},
    "active": {"0": "Inactive", "1": "Active"}
  },
  "registers": [
    {"name": "Input 1 alarm 1 value", "group": "Alarms", "area": "holding", "address": 1, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 28) moves the decimal point"},
    {"name": "Input 1 alarm 2 value", "group": "Alarms", "area": "holding", "address": 2, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 28) moves the decimal point"},
    {"name": "Input 2 alarm 1 value", "group": "Alarms", "area": "holding", "address": 3, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 32) moves the decimal point"},
    {"name": "Input 2 alarm 2 value", "group": "Alarms", "area": "holding", "address": 4, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 32) moves the decimal point"},
    {"name": "Input 3 alarm 1 value", "group": "Alarms", "area": "holding", "address": 5, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 36) moves the decimal point"},
    {"name": "Input 3 alarm 2 value", "group": "Alarms", "area": "holding", "address": 6, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 36) moves the decimal point"},
    {"name": "Input 4 alarm 1 value", "group": "Alarms", "area": "holding", "address": 7, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 40) moves the decimal point"},
    {"name": "Input 4 alarm 2 value", "group": "Alarms", "area": "holding", "address": 8, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 40) moves the decimal point"},
    {"name": "Input 5 alarm 1 value", "group": "Alarms", "area": "holding", "address": 9, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 44) moves the decimal point"},
    {"name": "Input 5 alarm 2 value", "group": "Alarms", "area": "holding", "address": 10, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 44) moves the decimal point"},
    {"name": "Input 6 alarm 1 value", "group": "Alarms", "area": "holding", "address": 11, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 48) moves the decimal point"},
    {"name": "Input 6 alarm 2 value", "group": "Alarms", "area": "holding", "address": 12, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 48) moves the decimal point"},
    {"name": "Input 7 alarm 1 value", "group": "Alarms", "area": "holding", "address": 13, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 52) moves the decimal point"},
    {"name": "Input 7 alarm 2 value", "group": "Alarms", "area": "holding", "address": 14, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 52) moves the decimal point"},
    {"name": "Input 8 alarm 1 value", "group": "Alarms", "area": "holding", "address": 15, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 1 (relay RL1). Raw integer: the number of decimal places set for this input (register 56) moves the decimal point"},
    {"name": "Input 8 alarm 2 value", "group": "Alarms", "area": "holding", "address": 16, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Alarm 2 (relay RL2). Raw integer: the number of decimal places set for this input (register 56) moves the decimal point"},
    {"name": "Number of inputs", "group": "Settings", "area": "holding", "address": 19, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 8},
    {"name": "Language", "group": "Settings", "area": "holding", "address": 20, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3, "description": "The document lists the languages as 1 to 4 (Portuguese, English, Spanish, and a fourth that is misspelled) but gives the range as 0 to 3, so the values are not mapped"},
    {"name": "Display mode", "group": "Settings", "area": "holding", "address": 21, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3, "enum": "display"},
    {"name": "Analog input common", "group": "Settings", "area": "holding", "address": 22, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 1, "enum": "common"},
    {"name": "Input shown on analog output", "group": "Analog output", "area": "holding", "address": 23, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 9, "enum": "analog_source"},
    {"name": "Analog output current range", "group": "Analog output", "area": "holding", "address": 24, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale"},
    {"name": "Input 1 current range", "group": "Input scaling", "area": "holding", "address": 25, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 1 full scale", "group": "Input scaling", "area": "holding", "address": 26, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 1 scale start", "group": "Input scaling", "area": "holding", "address": 27, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 1 decimal places", "group": "Input scaling", "area": "holding", "address": 28, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 2 current range", "group": "Input scaling", "area": "holding", "address": 29, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 2 full scale", "group": "Input scaling", "area": "holding", "address": 30, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 2 scale start", "group": "Input scaling", "area": "holding", "address": 31, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 2 decimal places", "group": "Input scaling", "area": "holding", "address": 32, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 3 current range", "group": "Input scaling", "area": "holding", "address": 33, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 3 full scale", "group": "Input scaling", "area": "holding", "address": 34, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 3 scale start", "group": "Input scaling", "area": "holding", "address": 35, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 3 decimal places", "group": "Input scaling", "area": "holding", "address": 36, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 4 current range", "group": "Input scaling", "area": "holding", "address": 37, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 4 full scale", "group": "Input scaling", "area": "holding", "address": 38, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 4 scale start", "group": "Input scaling", "area": "holding", "address": 39, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 4 decimal places", "group": "Input scaling", "area": "holding", "address": 40, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 5 current range", "group": "Input scaling", "area": "holding", "address": 41, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 5 full scale", "group": "Input scaling", "area": "holding", "address": 42, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 5 scale start", "group": "Input scaling", "area": "holding", "address": 43, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 5 decimal places", "group": "Input scaling", "area": "holding", "address": 44, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 6 current range", "group": "Input scaling", "area": "holding", "address": 45, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 6 full scale", "group": "Input scaling", "area": "holding", "address": 46, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 6 scale start", "group": "Input scaling", "area": "holding", "address": 47, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 6 decimal places", "group": "Input scaling", "area": "holding", "address": 48, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 7 current range", "group": "Input scaling", "area": "holding", "address": 49, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 7 full scale", "group": "Input scaling", "area": "holding", "address": 50, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 7 scale start", "group": "Input scaling", "area": "holding", "address": 51, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 7 decimal places", "group": "Input scaling", "area": "holding", "address": 52, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Input 8 current range", "group": "Input scaling", "area": "holding", "address": 53, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 8, "enum": "current_scale", "description": "Same values as the analog output range"},
    {"name": "Input 8 full scale", "group": "Input scaling", "area": "holding", "address": 54, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 8 scale start", "group": "Input scaling", "area": "holding", "address": 55, "type": "int16", "access": "RW", "write_min": -9999, "write_max": 9999, "description": "Raw integer: the decimal places of this input move the decimal point"},
    {"name": "Input 8 decimal places", "group": "Input scaling", "area": "holding", "address": 56, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 3},
    {"name": "Clock: day", "group": "Clock", "area": "holding", "address": 57, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 31},
    {"name": "Clock: month", "group": "Clock", "area": "holding", "address": 58, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 12},
    {"name": "Clock: year", "group": "Clock", "area": "holding", "address": 59, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 99, "description": "Year is two digits"},
    {"name": "Clock: hour", "group": "Clock", "area": "holding", "address": 60, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 23},
    {"name": "Clock: minute", "group": "Clock", "area": "holding", "address": 61, "type": "uint16", "access": "RW", "write_min": 0, "write_max": 59},
    {"name": "Log write interval", "group": "Logging", "area": "holding", "address": 62, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 120},
    {"name": "Log write hysteresis", "group": "Logging", "area": "holding", "address": 63, "type": "uint16", "access": "RW", "write_min": 1, "write_max": 100},
    {"name": "Input 1 measurement", "group": "Measurements", "area": "holding", "address": 1001, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 28) moves the decimal point"},
    {"name": "Input 2 measurement", "group": "Measurements", "area": "holding", "address": 1002, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 32) moves the decimal point"},
    {"name": "Input 3 measurement", "group": "Measurements", "area": "holding", "address": 1003, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 36) moves the decimal point"},
    {"name": "Input 4 measurement", "group": "Measurements", "area": "holding", "address": 1004, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 40) moves the decimal point"},
    {"name": "Input 5 measurement", "group": "Measurements", "area": "holding", "address": 1005, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 44) moves the decimal point"},
    {"name": "Input 6 measurement", "group": "Measurements", "area": "holding", "address": 1006, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 48) moves the decimal point"},
    {"name": "Input 7 measurement", "group": "Measurements", "area": "holding", "address": 1007, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 52) moves the decimal point"},
    {"name": "Input 8 measurement", "group": "Measurements", "area": "holding", "address": 1008, "type": "int16", "description": "Range -9999 to 9999. Raw integer: the number of decimal places set for this input (register 56) moves the decimal point"},
    {"name": "Alarm 1 (RL1) active", "group": "Status", "area": "holding", "address": 1009, "type": "bool", "enum": "active", "bit": 1, "description": "The document prints bit number 1 and does not say whether bits are counted from 0 or 1"},
    {"name": "Alarm 2 (RL2) active", "group": "Status", "area": "holding", "address": 1009, "type": "bool", "enum": "active", "bit": 2, "description": "The document prints bit number 2 and does not say whether bits are counted from 0 or 1"},
    {"name": "Self-diagnostics relay active", "group": "Status", "area": "holding", "address": 1009, "type": "bool", "enum": "active", "bit": 4, "description": "The document prints bit number 4 and does not say whether bits are counted from 0 or 1"},
    {"name": "Internal EEPROM error", "group": "Status", "area": "holding", "address": 1010, "type": "bool", "enum": "active", "bit": 2, "description": "The document prints bit number 2 and does not say whether bits are counted from 0 or 1"},
    {"name": "Analog input read error", "group": "Status", "area": "holding", "address": 1010, "type": "bool", "enum": "active", "bit": 4, "description": "The document prints bit number 4 and does not say whether bits are counted from 0 or 1"},
    {"name": "Analog input self-calibration error", "group": "Status", "area": "holding", "address": 1010, "type": "bool", "enum": "active", "bit": 5, "description": "The document prints bit number 5 and does not say whether bits are counted from 0 or 1"},
    {"name": "Event log write pointer", "group": "Logging", "area": "holding", "address": 1011, "type": "uint16"}
  ]
}
