Table of Contents
MP STUDIO 2 · Modbus Device Table
The device table sets out, in a table for each device, the values that the device reads and writes as a Modbus RTU master on other devices (slaves) such as inverters, temperature controllers and other PLCs (V1.1.0 and later). Consecutive addresses on the same device are read together in one transaction, and writes are sent only when a value changes. You can also have lines sent only at the moment you choose with the MBTRIG function in the ladder (V1.2.0 and later).
Opening the Device Table
Select Setting → Modbus RTU Master to open it. For a new project, or a project that already has a device table, the Modbus Device Table window opens. For a project that has only a list made in the previous MP STUDIO (such as the bundled Modbus example), the MODBUS MASTER SETTING window opens, and you can change the list into a device table with Move to table in that window (see below).
If a port is set to Modbus RTU Master in the Communication Setting window, you can also open the device table with the Open Modbus device table button in that window.
Window Layout
Top Row
| Item | Description |
|---|---|
| Port | Chooses the communication port (Comm Port 1 to Comm Port 3) used for the device table. The number of devices registered on each port is shown with it. |
| Baud | The communication settings of that port. Click it to open the Communication Setting window. |
| Cycle | The estimated time to go once through the polled reads and writes. |
| RAM · Flash | The memory the device table uses on the device. “(old method about N KB)” is the size the same content would take with the old list method. |
When you click OK, the selected port changes to Modbus RTU Master and download on that port is turned off. If you choose a port that is not a master yet, this notice is shown at the top of the window.
Devices
In the list on the left, click + Add device to add a device, and use Duplicate and Delete device to copy or delete one. Select a device to show its settings at the top right.
| Item | Default | Description |
|---|---|---|
| Name | Device N | A name for display. |
| Slave ID | An unused number | 0 to 247. It must not be the same as another device on the same port. 0 is broadcast (write only). |
| Reply wait (ms) | 100 | 20 to 60000. How long to wait for a reply. |
| Retries | 2 | 0 to 10. How many times to send again when there is no reply. |
| Recheck interval (s) | 5 | 1 to 3600. A device that still does not reply after the retries is skipped and checked again at this interval. |
| Word order | Low word first (CDAB) | The word and byte order of 2-word (32-bit) values. |
| Max read at once | Auto | The largest number of values read in one transaction. Leave it empty to have it set to suit the model. |
| Extra wait (ms) | 0 | 0 to 10000. Additional time to wait between transactions. |
| Status word | Empty (not used) | The word address that receives the device status. Click Auto to pick a free D word. |
The status word holds bit 0 = connected, bit 1 = being skipped and high byte = last error. A value of 0 means not connected.
Lines
Enter the values to exchange with the device, one per line.
| Column | Description |
|---|---|
| Direction | Read or write. It is set by the function. |
| Function | Choose from FC01 to FC06, FC15 and FC16. |
| Device address | The address on the other device (0 to 65535). |
| Count | 1 means a single value; 2 or more means a range starting at the PLC address. |
| PLC address | The device memory that exchanges the value (for example D10). |
| Type | The data type, set by the PLC address. |
| Description | A note. |
| Trigger | Leave it empty to poll. Enter 1 to 255 to send the line only when MBTRIG in the ladder calls it (see below). |
| Frame | The number of the transaction that contains this line. It matches the numbers in the Frames actually sent list below. |
Click + Add line to add a line. To enter several lines at once, copy them from Excel in the order “function · device address · count · PLC address · description · (trigger)” and click Paste lines (Excel), or press Ctrl+V in the table. Enter moves to the next line, and Ctrl+Delete deletes the line.
Frames actually sent at the bottom of the window lists, in order, the transactions the device actually sends. The very bottom shows the number of transactions compared with the old list method, such as “N values: old method N round trips → table M”. Click OK to apply the changes. Save the project to keep them in the file.
Reading and Writing
- Reading: consecutive device addresses with the same device and the same function are read together in one transaction. In Figure 1, #1 reads addresses 5 and 6 at once. The PLC addresses do not have to be consecutive. Unused addresses in between are not read to fill the gap, and a read larger than the maximum read at once is split.
- Order: the devices are communicated with one at a time, in turn.
- Writing: at start-up, all write values are sent once; after that, a value is sent only when it changes. For a device that has only writes, the values are sent again about every 5 seconds.
- When there is no reply: the request is sent again as many times as the retries, and if there is still no reply, that device is skipped and checked again at every recheck interval.
Triggered Sending (MBTRIG)
Lines with a trigger number are sent only when the MBTRIG function in the ladder calls them. Use this to send a setting only when a button is pressed, or to read a value only when you need it.
- Enter a number (1 to 255) in the Trigger column of the lines to send. A trigger table appears at the bottom of the window.
- If you want the ladder to know when sending has finished, enter a bit address (for example
M100) in Done bit in the trigger table. - Click OK.
- Add an
MBTRIGfunction to the ladder and enter the same number. Choose MBTRIG: Send Modbus Trigger in the Serialport category of the Functions panel, or typeMBTRIG 1in the Insert Function window (Ctrl+E).
- Each time the input of
MBTRIGchanges from off to on, the lines with that number are sent once. Keeping the input on does not repeat the sending. If the input is already on when the power is turned on, the lines are sent once. - Both read lines and write lines can be used. A write line sends its value at that moment even if the value has not changed.
- Lines with the same number are sent together, and if their addresses are consecutive, they are grouped into one transaction. You can use the same number for several devices on one port, but not on different ports.
- If the number is called several times before the lines are sent, they are sent only once. If it is called while they are being sent, they are sent once more after that finishes.
- The done bit turns on for one scan when sending finishes, whether it succeeded or failed. Check the reason for a failure in the status word of that device.
- Lines with a trigger number are not sent automatically at start-up. Lines without a number are polled as usual.
- The
MBTRIGnumber must be a constant from 1 to 255 that is used in the device table. Otherwise the cell turns red and the program cannot be compiled. For lines whose number has noMBTRIGin the ladder, the trigger table shows “There is no MBTRIG 1 in the ladder, so this is never sent.”
Moving an Old List into a Table
In a project that has an existing Modbus RTU master list, click Move to table at the bottom left of the list window to change the list into a device table. The list is emptied, the Modbus Device Table window opens, and a message shows how many rows were moved into how many devices. Lines with 2-word values become FC16 lines.
- If there is a line that cannot be read, or a device table already exists, nothing is moved.
- Moving changes the compiled program. Use Edit → Undo (
Ctrl+Z) to move it back. - The device table and the old list cannot be used together.
Device Status During Monitoring
If you open the device table window during monitoring, the status is shown on the card of each device that has a status word. Status is read only for the devices on the selected port.
| Shown as | Meaning |
|---|---|
| ● Connected | The device replies normally. |
| ▲ Connected · error | The device replies, but with an error (exception responses 01 to 06, a CRC error and so on). |
| ⏸ Being skipped | The device is skipped because it does not reply. It is checked again at every recheck interval. |
| ✕ Not connected | The device is not connected. |
A gray ○ means the status shown cannot be trusted, for example because the program on the device differs from this project or the PLC is not responding, and the reason is shown with it. ― marks a device without a status word.
Simulation
During simulation, the devices in the device table run as virtual Modbus slaves, and the simulation bar shows Virtual devices: N. In the Virtual device values tab of the device table window, you can change the read values and see the write values. Turn on No response to test what happens when that device does not reply.
- The values of the virtual devices are not saved.
MBTRIGand the done bit are simulated too. Exception responses and CRC errors are not simulated.- A device table with problems and the old list are not simulated.
Things to Check
- A port used by the device table must be set to Modbus RTU Master with Use this channel for download turned off. Clicking OK in the device table sets the port this way.
- If the device does not have enough RAM, the program cannot be compiled. Reduce the number of devices or lines, or reduce the memory area sizes.
- If receiving cells overlap the device clock (RTC) block, a warning is shown that the received values are overwritten with the time.
- The device table is saved in the project file (
.mpx). A file that uses triggers cannot be opened in V1.1.0.




