Modbus-IDA
December 28, 2006 http://www.Modbus-IDA.org 1/51
MODBUS APPLICATION PROTOCOL SPECIFICATION
V1.1b
CONTENTS
1
Introduction ................................................................................................................... 2
1.1 Scope of this document ........................................................................................ 2
2 Abbreviations ................................................................................................................ 2
3 Context ......................................................................................................................... 3
4 General description ....................................................................................................... 3
4.1 Protocol description.............................................................................................. 3
4.2 Data Encoding...................................................................................................... 6
4.3 MODBUS Data model ........................................................................................... 6
4.4 MODBUS Addressing model ................................................................................. 7
4.5 Define MODBUS Transaction................................................................................ 8
5 Function Code Categories ............................................................................................10
5.1 Public Function Code Definition ...........................................................................11
6 Function codes descriptions .........................................................................................12
6.1 01 (0x01) Read Coils...........................................................................................12
6.2 02 (0x02) Read Discrete Inputs............................................................................13
6.3 03 (0x03) Read Holding Registers .......................................................................15
6.4 04 (0x04) Read Input Registers ...........................................................................16
6.5 05 (0x05) Write Single Coil ..................................................................................17
6.6 06 (0x06) Write Single Register ...........................................................................19
6.7 07 (0x07) Read Exception Status (Serial Line only)..............................................20
6.8 08 (0x08) Diagnostics (Serial Line only)...............................................................21
6.8.1 Sub-function codes supported by the serial line devices ...........................22
6.8.2 Example and state diagram......................................................................24
6.9 11 (0x0B) Get Comm Event Counter (Serial Line only) .........................................25
6.10 12 (0x0C) Get Comm Event Log (Serial Line only) ...............................................26
6.11 15 (0x0F) Write Multiple Coils..............................................................................29
6.12 16 (0x10) Write Multiple registers ........................................................................30
6.13 17 (0x11) Report Slave ID (Serial Line only) ........................................................32
6.14 20 (0x14) Read File Record .................................................................................32
6.15 21 (0x15) Write File Record .................................................................................34
6.16 22 (0x16) Mask Write Register.............................................................................36
6.17 23 (0x17) Read/Write Multiple registers ...............................................................38
6.18 24 (0x18) Read FIFO Queue................................................................................41
6.19 43 ( 0x2B) Encapsulated Interface Transport .......................................................42
6.20 43 / 13 (0x2B / 0x0D) CANopen General Reference Request and Response
PDU ....................................................................................................................
43
6.21 43 / 14 (0x2B / 0x0E) Read Device Identification..................................................44
7 MODBUS Exception Responses ...................................................................................48
Annex A (Informative): MODBUS RESERVED FUNCTION CODES, SUBCODES AND
MEI TYPES ..................................................................................................................
51
Annex B (Informative): CANOPEN GENERAL REFERENCE COMMAND .............................51