Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Modbus
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== PDU and ADU === Modbus defines a ''client'' which is an entity that initiates a transaction to request any specific task from its ''request receiver''.{{Sfn|MODBUS Application Protocol|2012|p=4|ps=, "4.1 Protocol description"}} The client's "request receiver", which the client has initiated the transaction with, is then called the ''server''.{{Sfn|MODBUS Application Protocol|2012|p=4|ps=, "4.1 Protocol description"}} For example, when a [[Microcontroller unit]] (MCU) connects to a sensor to read its data by Modbus on a wired network, e.g RS485 bus, the MCU in this context is the client and the sensor is the server. In former terminology, the client was named master and the server named slave. Modbus defines a [[protocol data unit]] (PDU) independently to its lower layer protocols in its protocol stack. Mapping MODBUS protocol on specific buses or networks requires some additional fields, defined as the application data unit (ADU). The ADU is formed by a ''client'' inside a Modbus network when the client initiates a transaction. Contents are:{{Sfn|MODBUS Application Protocol|2012|p=3|ps=, "4.1 Protocol description"}} * PDU = Function code + data * ADU = Additional address + PDU + error check The ADU is officially called a ''Modbus frame'' by the Modbus Organization,{{Sfn|MODBUS Application Protocol|2012|p=3|ps=, "4.1 Protocol description"}} although ''frame'' is used as the data unit in the data-link layer in the OSI and TCP/IP model (while Modbus is an application layer protocol). PDU max size is 253 bytes. ADU max size on RS232/RS485 network is 256 bytes, and with TCP is 260 bytes.{{Sfn|MODBUS Application Protocol|2012|p=5|ps=, "4.1 Protocol description"}} For data encoding, Modbus uses a big-endian representation for addresses and data fields. Thus, for a 16-bit value, the most significant byte is sent first. For example, when a 16-bit register has value 0x1234, byte 0x12 is sent before byte 0x34.{{Sfn|MODBUS Application Protocol|2012|p=5|ps=, "4.1 Protocol description"}} ''Function code'' is 1 byte which gives the code of the function to execute. Function codes are integer values, ranging from 1 to 255, and the range from 128 to 255 is for exception responses. The data field of the PDU has the address from 0 to 65535 (not to be confused with the address of the Additional address field of ADU).{{Sfn|MODBUS Application Protocol|2012|p=7|ps=, "4.4 MODBUS Addressing model"}} The data field of the PDU can be empty, and then has a size of 0. In this case, the server will not request any information and the function code defines the function to be executed. If there is no error during the execution process, the data field of the ADU response from server to client will include the data requested, i.e. the data the client previously received. If there is any error, the server will respond with an exception code.{{Sfn|MODBUS Application Protocol|2012|p=4|ps=, "4.1 Protocol description"}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)