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!
== Modbus Messaging on TCP/IP == === Modbus TCP === ''Modbus TCP'' or ''Modbus TCP/IP'' is a Modbus variant used for communications over [[TCP/IP]] networks, connecting over port 502.{{Sfn|MODBUS Messaging on TCP/IP|2006|p=6|ps=}} It does not require a checksum calculation, as lower layers already provide checksum protection. Modbus TCP nomenclature is the same as for the Modbus over Serial line protocol, as any device which send out a Modbus command, is the 'client' and the response comes from a 'server'.<ref name=":0">{{Cite web |last=Prat |first=JΓ©rΓ΄me |date=13 February 2017 |title=Crash Course: Client/Server/Master/Slave |url=https://www.prosoft-technology.com/insights/technology-focus/# |access-date=2022-10-17 |website=ProSoft Technology}}</ref> The ADU for Modbus TCP is officially called ''Modbus TCP/IP ADU'' by the Modbus organization{{Sfn|MODBUS Messaging on TCP/IP|2006|p=4|ps=, "3.1.2 MODBUS On TCP/IP Application Data Unit"}} and is also called ''Modbus TCP frame'' by other parties.<ref name="Drury2009" /> MODBUS TCP/IP ADU = MBAP Header + Function code + Data Where MBAP - which stands for MODBUS Application Protocol header - is the dedicated header used on TCP/IP to identify the MODBUS Application Data Unit. The MBAP Header contains the following fields:{{Sfn|MODBUS Messaging on TCP/IP|2006|p=5|ps=, "3.1.3 MBAP Header description"}} {| class="wikitable" style="float:middle; margin:0 0 1em 1em;" |- ! Name ! Length (bytes) ! Function |- ! Transaction identifier | 2 | For synchronization between messages of server and client |- ! Protocol identifier | 2 | 0 for Modbus/TCP |- ! Length field | 2 | Number of remaining bytes in this frame |- ! Unit identifier | 1 | Server address (255 if not used), treated like slave address in Modbus over Serial line |} ''Unit identifier'' is used with Modbus TCP devices that are composites of several Modbus devices, e.g. Modbus TCP to Modbus RTU gateways. In such a case, the unit identifier is the Server Address of the device behind the gateway. A MODBUS TCP/IP ADU/Modbus TCP frame format then will be:{{Sfn|MODBUS Messaging on TCP/IP|2006|p=5|ps=, "3.1.3 MBAP Header description"}}{{Sfn|MODBUS Messaging on TCP/IP|2006|p=4|ps=, "3.1.2 MODBUS On TCP/IP Application Data Unit"}} {| class="wikitable" style="float:middle; margin:0 0 1em 1em;" !Transaction identifier !Protocol identifier !Length !Unit identifier !Function code !Data |- |2 bytes |2 bytes |2 bytes |1 byte |1 byte |n bytes |} ====Example of a Modbus TCP/IP ADU/Modbus TCP frame in hexadecimal==== <code>12 34 00 00 00 06 01 03 00 01 00 01</code> * <code>0x12</code> and <code>0x34</code> : With transaction ID = 0x1234 (2 bytes) as a "unique number" to be identified between the Modbus TCP client/server, the transaction ID High byte is 0x12 and transaction ID Low byte is 0x34 * <code>0x00</code> and <code>0x00</code> : Protocol identifier high byte and low byte * <code>0x00</code> and <code>0x06</code> : Length high byte and low byte. The length is 6 bytes which includes: unit identifier (slave address) (1 byte), function code (1 byte), high byte of the register address to read (1 byte), low byte of the register address to read (1 byte) and data (2 bytes = high byte and low byte of the number of registers to read) * <code>0x01</code> : Unit identifier (slave address) * <code>0x03</code> : Function code (Read Multiple Holding Registers) * <code>0x00</code> and <code>0x01</code> : high byte and low byte of the register address to read. The register address to read in this case is <code>0x0001</code>. * <code>0x00</code> and <code>0x01</code> : high byte and low byte of the number of registers to read. The number of registers to read in this case is <code>0x0001</code>. (i.e 1 register) === Other Modbus protocol versions over TCP/IP === *''Modbus over TCP/IP'', ''Modbus over TCP'', or ''Modbus RTU/IP'' β a variant that differs from Modbus TCP in that a checksum is included in the payload, as with Modbus RTU. * ''Modbus over UDP'' β some have experimented with using Modbus over [[User Datagram Protocol|UDP]] on IP networks, which removes the overhead of TCP.<ref>{{cite web |year=2010 |title=Java Modbus Library - About |url=http://jamod.sourceforge.net |access-date=2017-02-07}}</ref>
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)