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).

Figure 1. The Modbus Device Table window (the bundled Modbus example moved into a table)

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

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.

  1. 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.
  2. 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.
  3. Click OK.
  4. Add an MBTRIG function to the ladder and enter the same number. Choose MBTRIG: Send Modbus Trigger in the Serialport category of the Functions panel, or type MBTRIG 1 in the Insert Function window (Ctrl+E).

Figure 2. Trigger 1 and done bit M100 set on the line that writes the run command

Figure 3. A rung that sends trigger 1 when M10 turns on

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.

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.

Figure 4. Virtual device values of the device table during simulation

Things to Check

← Back to the MP STUDIO 2 User Manual