Interview questions on Modbus

11. What are the various function codes?

Function CodeRegister Type
1Read Coil
2Read Discrete Input
3Read Holding Registers
4Read Input Registers
5Write Single Coil
6Write Single Holding Register
15Write Multiple Coils
16Write Multiple Holding Registers

12. What are the different registers in Modbus?

Discrete Coil: Read or write discrete values from/to the device. Valid registers in the range of 1 – 9999.

Discrete read-only coils: Read discrete values from/to the device. Valid registers in the range of 10001 – 19999.

Analog Input registers: Input registers are used to read 16-bit long analog values, which can be read-only. Valid addresses are in the range of 30001 – 39999. Floating or double-floating data can be handled when consecutive addresses are assigned.

Analog Holding Register: Holding registers are used to read/write 16-bit long analog values, which can be read-only. Valid addresses are in the range of 30001 – 39999. Floating or double-floating data can be handled when consecutive addresses are assigned.

13. What is CRC?

CRC stands for Cyclic redundancy check. It is the additional two bytes appended to the end of each message for error detection. If the CRC in the received message sent by the master does not match the CRC calculated by the slave, the message should be ignored.

14. What is LRC?

LRC stands for Longitudinal Redundancy Check. It is the value appended to the end of each message to assure that the data received is not corrupted. It is used in Modbus ASCII.

15. What is a Modbus Map?

A Modbus map is the list of data stored in each register of a slave device. It is used when forming a Modbus request. It contains details about what data is stored in each register and their datatype. An example Modbus map is shown below:

Interview questions on Modbus: What is a Modbus Map?

Below are a few important Interview questions on Modbus TCP/IP.

16. What is Modbus TCP/IP?

Modbus TCP/IP is simply Modbus RTU that uses TCP/IP networking standard and ethernet as a physical medium to transmit data of Modbus message structure between compatible devices. The data is embedded into a TCP frame without checksum.

17. What are the components of a Modbus TCP/IP data packet?

In a Modbus TCP/IP data packet, the function code and the data are embedded into a

Modbus TCP/IP data packet

18. What is the MBAP header?

MBAP stands for Modbus application protocol. An MBAP header contains the following fields:

FieldLength (bytes)Description
Transaction identifier2Identification of a transaction type: request/response.
Protocol identifier2Protocol ID for Modbus is 0.
Length2Number of following bytes
Unit identifier1Slave unit ID.

19. What is a PDU?

The Protocol Data Unit (PDU) is the request or response message and is independent of the underlying communication layer. It contains a function code and data. The general structure of a PDU is listed below:

FieldSize (bytes)
Function code1
dataN

20. Structure of Modbus TCP/IP Application Data Unit (ADU)

data transfer occur in TCP/IP

Leave a Comment