11. What are the various function codes?
|Function Code||Register Type|
|2||Read Discrete Input|
|3||Read Holding Registers|
|4||Read Input Registers|
|5||Write Single Coil|
|6||Write Single Holding Register|
|15||Write Multiple Coils|
|16||Write 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:
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
18. What is the MBAP header?
MBAP stands for Modbus application protocol. An MBAP header contains the following fields:
|Transaction identifier||2||Identification of a transaction type: request/response.|
|Protocol identifier||2||Protocol ID for Modbus is 0.|
|Length||2||Number of following bytes|
|Unit identifier||1||Slave 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: