Modbus Protocol en
Modbus Protocol en
C Implementation Classes
1978
OSI model
Layer 7
Used by
various media
Modbus on
Ethernet TCP-IP
1,000 rpm
Response
The Client is the entity The Server is the entity that
requesting a service provides the service
byte
Function
Address Data Error check
Code
Run function
C Implementation Classes
Public
User defined
72
Can be implemented without agreement from Modbus.org User defined
65
Not guaranteed to be unique
Reserved Public
Used by certain companies and not available
Discrete
Discrete Inputs Bit Read only
inputs
Application
Coils Bit Read/Write
modifiable data
Application
Holding Registers Word Read/Write
modifiable data
Sub
Function code
code
Decimal Hex. Decimal
C Implementation Classes
Messaging Device
Management
An embedded
Basic Regular Extended function level model
Access to
registers CF 03: Read Holding Registers
Basic CF 16: Write Multiple Registers
only
Regular +
CF 20: Read File Record
Access
to files CF 21: Write File Record
Write Single Register and Write Single Coil are strongly recommended for servers
(to ensure compatibility with former products).
Access to
Vendor Name, CF 43: Read Device Identification
Basic Product Code Sub code 14 – Level 1 access
and Version
Basic +
Regular Access to Vendor CF 43: Read Device Identification
URL, Product Name, Sub code 14 – Level 2 access
Model Name, User
Extended Application Name
C Implementation Classes
0 to 65535 n = 1 to 125
Response:
1 byte 2 bytes 2 bytes 2 bytes
Function Value Value
Code Number of
of the first of the last
bytes read
03 register register
Response:
1 byte 2 bytes 2 bytes
Function Address Number of
Code of the first registers
16 register written
0 to 65535 n = 1 to 123
0 to 65535 0 to 65535
Response:
0 to 65535 0 to 65535
0 to 65535 n =1 to 2000
Response:
1 byte 1 byte 1 byte 1 byte
Function
Code Number Value of Value of
of bytes read the first byte the last byte
01
0 to 65535 n =1 to 2000
Response:
1 byte 1 byte 1 byte 1 byte
Function
Code Number of Value of Value of
bytes read the first byte the last byte
02
Response:
1 byte 2 bytes 2 bytes
Function Address of the Number of
Code first digital digital outputs
15 output written
0 to 65535 n =1 to 1968
Response:
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte
Function Number of
Sub funct. Access Implementation Split If split, address
Code identification
Code 14 Level class supported response of next object
objects
43
0 = no
1 to 4 1 to 3 1 to 255 1 to 255
255 = yes
1 byte 1 byte n bytes 1 byte 1 byte n bytes
Address Length Value of object Add. object Len. object Value of object
object m object m m m+1 m+1 m+1
m = 0 to 255 n = 1 to 255