Understanding the Importance of Modbus Register Maps

Modbus is an industrial protocol standard that was created in the late 1970’s for communication among programmable logic controllers (PLCs). To put it simply, Modbus Register Maps lists data from a device that defines what the data is, where the data is stored, and how the data is stored. Modbus remains the most widely available protocol for connecting industrial devices. 

Modbus protocol is defined as a master/slave protocol, meaning a device operating as a master will poll one or more devices operating as a slave. This means a slave device cannot volunteer information, it must wait to be asked for it. The master will write data to a slave device’s registers, and read data from a slave device’s registers. A register address or register reference is always in the context of the slave’s registers.

The most commonly used form of Modbus protocol is RTU over RS-485. Modbus RTU is a relatively simple serial protocol that can be transmitted via traditional UART technology. Data is transmitted in 8-bit bytes, one bit at a time, at baud rates ranging from 1200 bits per second (baud) to 115200 bits per second. The majority of Modbus RTU devices only support speeds up to 38400 bits per second.

A Modbus RTU network has one Master and one or more Slaves. Each slave has a unique 8-bit device address or unit number. Packets sent by the master include the address of the slave the message is intended for. The slave must respond only if its address is recognized and must respond within a certain time period or the master will call it a “no response” error.

Each exchange of data consists of a request from the master, followed by a response from the slave. Each data packet, whether request or response, begins with the device address or slave address, followed by function code, followed by parameters defining what is being asked for or provided. The exact formats of the request and response are documented in detail in the Modbus protocol specification. The general outline of each request and response is illustrated below.

Modbus data is most often read and written as “registers” which are 16-bit pieces of data. Most often, the register is either a signed or unsigned 16-bit integer. If a 32-bit integer or floating point is required, these values are actually read as a pair of registers. The most commonly used register is called a Holding Register, and these can be read or written. The other possible type is Input Register, which is read-only.

The exceptions to registers being 16 bits are the coil and the discrete input, which are each 1 bit only. Coils can be read or written, while discrete inputs are read-only. Coils are usually associated with relay outputs.

The type of register being addressed by a Modbus request is determined by the function code. The most common codes include 3 for “read holding registers”, and may read 1 or more. Function code 6 is used to write a single holding register. Function code 16 is used to write one or more holding registers.

Modbus slave devices can be visualized as having an internal spreadsheet filled with numbers. The Modbus master will ask a slave for its data value or number found in a given row and column, and the slave will respond by sending that piece of data back to the master. Of course, this process can be reversed with the Modbus master telling the slave what number to put into its data table at a given row and column.

The “columns” in a Modbus device’s “spreadsheet” are more formally known as register types. Register type may be a coil, a discrete input (aka status input), an input register, or a holding register.

The “rows” in a Modbus device’s “spreadsheet” are simply the register number. Most often, these start at 1 and count up sequentially. Some devices might not have a register 1, and their first register may be number 100 for example. If the register number does not exist in the slave device, it will send back an “oops” message properly known as an exception. The exception provides an error code that says “no such register” (exception code 2, illegal data address). To view Otis Instruments Modbus Register Maps, click here. Safety is our top priority, so we also offer a variety of Wired and WireFree easy-to-use, robust and configurable gas detectors. Made in the USA, our high-quality products are capable of detecting both toxic and non-toxic gases for diverse applications. If you would like more information about a product or gas detection topic, or need more specific assistance regarding gas detection for your application, contact our team today.