Did you know that Modbus has standards for numbering registers? It turns out, if you access register 10004, you should expect to get different information than if you access the register at 30392. Why is this?
Let's take a look at the Modbus standard to understand what to expect from different Modbus register locations and how they can help you get more information out of your equipment with Critical Labs.
The table below describes the Modbus standard for different register addresses in the protocol (table information courtesy of Simply Modbus):
|Read-Write||1||Status/Coil (State controls)||0 or 1|
|Read-Only||2||Input Contact (State information)||0 or 1|
|Read-Only||4||Input Registers (Numerical values)||0 to 32767|
|Read-Write||3||Holding Registers (Numerical values)||0 to 32767|
The first 9999 registers are designed to handle control input. Examples of this would include starting a piece of equipment or changing its state. Critical Labs does not support controlling equipment, so we typically do not deal with registers in this domain.
Registers in the 1xxxx range are for reading state. These values are either 0 or 1. In the Critical Labs web app, you can give the 0 value a state name and the 1 value a state name. This is currently done using a special shorthand in the sensor's unit.
Registers in the 3xxxx and 4xxxx range are considered numerical, meaning that they can hold large number values. Each register is 16-bits long and can hold a signed integer, an unsigned integer, or a float. Depending on the manufacturer of the equipment and how they chose to implement Modbus, these data types can vary.
Some manufacturers will provide an integer (a whole number) and then a corresponding "multiplier" (such as 0.1) to convert that whole number to a decimal. Some manufacturers will provide the value as a float. Some will support signed integers (negative numbers) and others won't.
Usage with Critical Labs
The key here is to find the manufacturer's documentation on how the equipment's Modbus registers are implemented. Critical Labs provides a number of different options when creating Modbus register mappings to accommodate manufacturer specifications, including:
- Function code - this explains what type of data is found in the register and, if standards are followed, where the register is located
- Starting register - the register you are trying to access
- Name - the name of the register (or description of the data it contains)
- Unit - For numerical values, this is the unit. For state registers, use the shorthand to tell the Critical Labs app what you would like to name the states
- Multiplier - manufacturers sometimes provide a multiplier to be used with a value in a register. Only input this if the manufacturer's documentation provides a value
- Offset - manufacturers sometimes provide a numerical offet to be used with a value in a register. Only input this if the manufacturer's documentation provides a value
- Address offset - this is used to help Critical Labs locate the register data on a piece of equipment. If the manufacturer followed the above standards, then these values should be pre-populated. If the manufacturer did not follow standards, then they may be using a custom address offset. This may take some experimentation to figure out what this value is
- Data Type - The type of data stored in the register. This should be specified in the manufacturer's documentation
- Number of Registers - The number of registers that Critical Labs should read to get the correct data value. This can be specified in the manufacturer's documentation or it can be inferred by the data type. If the data type is a signed or unsigned 32-bit integer, for instance, the number of registers is probably 2. If it's a 16-bit integer, then the number of registers is probably 1