Modbus is a low-speed serial data protocol commonly used in industrial applications where a supervisory computer (master) controls or monitors multiple remote devices (slaves).
The specification was originally published in 1979 by Modicon (now Schneider Electric) for use with its programmable logic controllers (PLCs).
In a standard Modbus network there is one master, and up to 247 slaves each with a unique address from 1 to 247.
PicoScope (Beta) software provides support for Modbus RTU and Modbus ASCII.
Several versions of Modbus have been developed to suit the transmission medium being used. Most common are:
The Modbus protocol defines a Protocol Data Unit (PDU), which is independent of the underlying communication layers. Additional fields may be introduced in the Application Data Unit (ADU) depending on the type of bus or network employed.
Protocol Data Unit (PDU) contains:
Application Data Unit (ADU) contains:
Error Codes - When the server responds to the client it uses the function code field to indicate either a normal (error-free) response or that some kind of error occurred, called an exception response. For a normal response the server simply echoes the original function code and returns the data requested.
Data is stored in slave devices in four different tables. Two of them store on-off (1-bit) values called Coils and Discrete Inputs, and two store numerical values as 16-bit words called Registers. Each is either read-only or read/write.
Each table has 9999 locations.
There are three categories of Modbus function codes:
Examples of commonly used function codes are shown in the table.
The full specification for Modbus is freely available from www.modbus.org
When errors occur, troubleshooting with a PicoScope using Modbus protocol decoding allows you to correlate decoded frames with the data captured by the oscilloscope. This helps identify where data is corrupted due to noise, interference or incorrect voltage levels, for example.
Acquiring Modbus data on your PicoScope
Use two oscilloscope channels, one for the master transmit lines and the other for the slave transmit lines. Where Modbus is transmitted over RS-422 or RS-485, use differential probing.
Set memory length to enough to acquire as many frames as required, and with enough sampling resolution to resolve individual bits.
Alternatively use the buffer memory index to capture short bursts of frames whilst ignoring any dead time in between.
Use the horizontal zoom control to view a single frame in detail.
Add a second scope view to display master and slave data frames simultaneously.
Select Serial Decoding from the Tools menu.
Click Create and choose from either Modbus RTU or Modbus ASCII.
In the setup window most fields are automatically populated. Just define which channel is master and which is slave.
If Graph is checked, a colour-keyed trace will appear in the graph display, time-correlated with the acquired data.
If Table is checked, all the data will be presented in a table format. There are several useful features available with the table:
Modbus RTU and Modbus ASCII decoders are a standard feature with PicoScope (Beta) software and can be used with all real-time PicoScope models.
Modbus® is a registered trademark of Schneider Electric, licensed to the Modbus Organization, Inc.