Skip to content

SetDigPort0CfgStructMsg

Set Dig Port 0 Cfg Struct Msg

AM Type: 168

Source Code


Field Bits Type Condition Description
ls_header_down Struct Always
└── am_type 8 UInt Always
messageVersion 4 UInt Always
typeOfSensor 8 Enum Always MODBUS (0), LUA (1)
portEnabled 1 Bool Always
powerVoltage 1 Enum Always V_5 (0), V_12 (1)
powerAlwaysOn 1 Bool Always
powerThreshold 16 UInt Always
resetOnFailure 1 Bool Always
terminationResistor 1 Bool Always
usbPowerRailOff 1 Bool Always
rfu 2 Reserved Always
sensorTypeMsgVersion 4 UInt Always
payload Switch Always
├── modbusBaudrate 24 UInt typeOfSensor == MODBUS
├── uartDatabits 8 UInt typeOfSensor == MODBUS
├── parity 8 Enum typeOfSensor == MODBUS NONE (0), EVEN (1), ODD (2)
├── stopBits 8 Enum typeOfSensor == MODBUS HALF (0), ONE (1), ONE_AND_HALF (2), TWO (3)
├── Sensor Addresses [ ] Seq typeOfSensor == MODBUS
│   └──  8 UInt
├── luaTimeOut 16 UInt typeOfSensor == LUA
├── luaRedundancyFrames 2 UInt typeOfSensor == LUA
├── maximumDataSize 14 UInt typeOfSensor == LUA
├── integration Struct typeOfSensor == LUA
│   ├── id 16 UInt typeOfSensor == LUA
│   └── version Struct typeOfSensor == LUA
│       ├── major 5 UInt typeOfSensor == LUA
│       └── minor 5 UInt typeOfSensor == LUA
└── rfu 6 Reserved typeOfSensor == LUA

Example

modbus_empty_sensors

Source: DigPort0CfgMessages.py

JSON Message

{
  "ls_header": {
    "uplink_version": {
      "value": "4",
      "raw": 4
    },
    "product_code": {
      "value": "94",
      "raw": 94
    },
    "node_id": {
      "value": "87",
      "raw": 87
    },
    "sequence_number": {
      "value": "1",
      "raw": 1
    },
    "am_type": {
      "value": "168",
      "raw": 168
    }
  },
  "messageVersion": {
    "value": "0",
    "raw": 0
  },
  "typeOfSensor": {
    "value": "MODBUS",
    "raw": 0
  },
  "portEnabled": {
    "value": true,
    "raw": true
  },
  "powerVoltage": {
    "value": "V_5",
    "raw": 0
  },
  "powerAlwaysOn": {
    "value": false,
    "raw": false
  },
  "powerThreshold": {
    "value": "1000",
    "raw": 1000
  },
  "resetOnFailure": {
    "value": true,
    "raw": true
  },
  "terminationResistor": {
    "value": false,
    "raw": false
  },
  "usbPowerRailOff": {
    "value": false,
    "raw": false
  },
  "rfu": {
    "value": "0",
    "raw": 0
  },
  "sensorTypeMsgVersion": {
    "value": "0",
    "raw": 0
  },
  "payload": {
    "modbusBaudrate": {
      "value": "9600",
      "raw": 9600
    },
    "uartDatabits": {
      "value": "8",
      "raw": 8
    },
    "parity": {
      "value": "NONE",
      "raw": 0
    },
    "stopBits": {
      "value": "ONE",
      "raw": 1
    },
    "sensorAddresses": []
  }
}

Encoded Bytes

Source:

BitArray(
            "hex = 40 5E 00 57 01 A8,"  # LS Header (am_type 168)
            "uint:4 = 0,"  # messageVersion
            "uint:8 = 0,"  # typeOfSensor (MODBUS)
            "bool = True,"  # portEnabled
            "uint:1 = 0,"  # powerVoltage (V_5)
            "bool = False,"  # powerAlwaysOn
            "uint:16 = 1000,"  # powerThreshold
            "bool = True,"  # resetOnFailure
            "bool = False,"  # terminationResistor
            "bool = False,"  # usbPowerRailOff
            "uint:2 = 0,"  # rfu
            "uint:4 = 0,"  # sensorTypeMsgVersion
            # MODBUS Payload
            "uint:24 = 9600,"  # modbusBaudrate
            "uint:8 = 8,"  # uartDatabits
            "uint:8 = 0,"  # parity (NONE)
            "uint:8 = 1,"  # stopBits (ONE)
            "uint:8 = 0"  # numSensors
            # No sensorAddresses (empty list)
        ).hex

Result:

40 5e 00 57 01 a8 00 08 07 d1 00 00 25 80 08 00 01 00