Applicable Model(s)

HMC2000
HMC3000
HMC4000
HMC7000
Maple MLC

Title

Modbus Communication in MAPware-7000

Date

09/27/2022

Rev

03

P/N

0907-7016

Summary

Both Maple Systems HMC (HMI + PLC) and MLC (PLC) can be configured to act as a Modbus Master and/or a Modbus Slave. This document goes over how to set up this communication and use tags in your project.

See Tech Note 7015 – MAPware-7000 Modbus Tag Converter Utility for instructions on how to use the converter utility to generate all Modbus slave addresses for a Native Ladder project.


Solution

1.

This tech note will go over setting up an MLC1-E as a Modbus RTU Slave (Server) device communicating with an HMC7070A-M acting as a Modbus RTU Master (Client). We will set up the required drivers in MAPware-7000 and show how to copy data from the MLC1-E into local tags in the HMC7070A-M so that they can be used in logic. A 7448-0215-5 RS232 serial cable is used to connect the MLC1-E to the HMC7070A-M.

Modbus RTU (Serial) Controller Info Sheets

Modbus TCP/IP (Ethernet) Controller Info Sheets


2.

Configuring the Modbus Slave

To configure an HMC or MLC product to act as a Modbus Slave, first choose what COM port it will communicate over. In MAPware-7000 go to [Network Configuration] > [COMx], where x is the COM port chosen, and select [Add].

In this example, we will be using an MLC1-E as the base unit and setting up the connection on COM1. For the model, COM1 is an RS232 serial connection and as such, we will select [Modbus RTU (Unit as Slave)].

Once selected, configure the connection settings to match the Master device. In this example, we are connecting it to an HMC7070A-M as the Modbus Master that is expecting the Slave to be on Address 1, have a Baud Rate of 9600, 8 Data Bits, Even Parity, and 1 Stop Bit, and thus have defined the connection as such.

Note: If this unit supported Ethernet and you wanted to use Modbus TCP/IP, this step would be skipped, as the Modbus TCP/IP Slave driver is supported by default on the [COM3 (Ethernet)] port and requires no driver configuration.


3.

Native Ladder Addressing

Native Ladder mode programming in MAPware-7000 uses register-based tag addressing and automatically assigns Modbus slave addresses. Refer to the table below for the default Modbus addressing.

PLC Address Types Address Range Modbus Address Write access
Timer Register (T)0-00255400001-400256Read/write
Counter Register (C)0-00255410001-410256Read/write
System Register (SW)0-0255420001-420256Read/write
Retentive Register (R)0-01399430001-431400Read/write
Input Register (XW) 10-3100440001-4404001Read only
Output Register (YW) 10-3100441001-4414001Read/write
Internal Register (BW)0-0255442001-442256Read/write
Index Registers (I,J,K)0-2443001-443003Read/write
Configuration Register (MW) 10-1599460001-461600 1Read/write
Data Register (D)0-04095450001-454096Read/write
System Coil (S)0-00099020001-020100Read/write
Internal Coil (B)0-04095030001-034096Read/write
Timer Coil (T)0-0255021001-021256Read/write
Counter Coil (C)0-0255022001-022256Read/write
Configuration Coil (M) 20-25599035001-060600 2Read/write
Input Coil (X) 20-6399000001-006400 2Read only
Output Coil (Y) 20-6399010001-016400 2Read/write

Input (XW), Output (YW), and Configuration Register (MW) addressing starts at the beginning Modbus address and continues sequentially based on the memory allocated for each base unit and I/O module in use. The amount of memory allocated can be found in the [IO Allocation] window.

X and XW, Y and YW, and M and MW addresses in MAPware-7000 products share memory locations. Modbus addresses are sequential based on XW, YW, and MW addresses present in the program, and so 0x bit addresses may have gaps between them.

See Tech Note 7015 – MAPware-7000 Modbus Tag Converter Utility for instructions on how to use the converter utility to generate all Modbus addresses for a Native Ladder project.


4.

IEC 61131-3 Addressing

In IEC mode, the addressing for each tag must be set manually in the tag library and is customizable. Go to [Tags] and click in the column defined by the COM port being used for communication. In this example, we are using [COM1]. Then, enter a Modbus address for the tag. Boolean tags will take 0x addresses, while all other data types will take 4x addresses.

If the [Com 1] or [Com 2] column is not available, check that your project is configured as an IEC 61131-3 project, and also that you have configured a Modbus RTU Slave driver on the appropriate port in the [Network Configuration]. On models with an Ethernet port, the [Ethernet] column will be available by default.

Note: It is recommended that you assign sequential Modbus addresses, as many Modbus Master/Client devices will read data as a block. Keep in mind that DWORD and DINT tags will use two register/addresses, as Modbus uses 16-bit registers.


5.

Configuring a Modbus Master

To configure an HMC or MLC product to act as a Modbus Master, first choose what COM port it will communicate over. In MAPware-7000 go to [Network Configuration] > [COMx], where x is the COM port chosen, and select [Add].

In this example, we will be using an HMC7070A-M as our Modbus RTU Master and setting up the connection on COM1. Select [Modbus RTU (Unit as Master)].

Once selected, configure the connection parameters to match the Modbus Slave device. In this example, we are connecting it to an MLC1-E as the Modbus Slave that is on Address 1, has a Baud Rate of 9600, 8 Data Bits, Even Parity, and 1 Stop Bit, and thus have defined the connection as such.

If we were using Modbus TCP/IP, instead we would select [COM3 (Ethernet)] as the port, [Modbus/TCP Master (Client)] as the [Protocol], and set the [IP Address] to the Modbus Slave’s IP.


6.

Adding Tags

Now that the devices have been configured as Master (HMC7070A-M) and Slave (MLC1-E), we can add tags to the Master (HMC7070A-M) project that will access data from the Slave (MLC1-E) device. The Master device controls all Modbus communication, so no other changes will be made to the MLC1-E project. Tags will need to be defined in the HMC7070A-M project to pass the data back and forth.

Go to the [Tags] database and click [Add Tag]. From the [Node Name] dropdown, select your Slave device. In the [Register/Coil Type] dropdown, Coils correspond to 0x addresses, Input Coils to 1x addresses, Input Registers to 3x addresses, and Holding Registers to 4x addresses.

In this example, we are connecting to an MLC1-E and wish to get Tag Address D00000 as well as Coil B00000, which correspond to Modbus addresses 450001 and 030001 respectively.


7.

Data Transfer (Using tags in logic)

MAPware-7000 only allows local tags to be used in ladder logic. In order to use data from the MLC1-E in our code, we must copy the data into local tags. In this example, we will define two tags to copy the Modbus data into, Internal D0000 and Internal B0000.

With both the Slave and Master tags defined, now go to [Tasks] to define the transfer of data. In the Tasks screen, select the [Global Tasks] radio button.

There are two different Task types to use, one for word tags and one for coils. For word data, select one of the [Copy Block] tasks. This will handle copying blocks of word data between the Slave and Master devices. For coil or bit data, instead use the [Copy Tag] task to move a single tag from Slave to Master.

Select the [Copy HMI/PLC Block to HMI Block] task for our first data transfer. In the setup, [Tag A (HMI)] defines the destination and [Tag B (HMI/PLC)] defines the source. The [Number of Words] option determines how much data to copy into internal memory. In this example, we are only copying one tag, but you can copy up to 999 words of data from your external slave device to internal memory at a time.

The [Enable Control] option allows your data transfer to be controlled from within logic or from screens. If selected, the data transfer is only active while the [Enable Tag] is true, and one-shot push or pulls can be achieved by monitoring the [Done Tag] for data transfer completion.

When pulling in read only data such as XW registers, this feature is likely not useful, but when reading and writing to the same tag, being able to control the action from logic can be useful.

Once the tags are selected, simply click [Add] and the data from the Slave device is now available through the local Master device tag.

If the goal is to send data to the Slave from the Master device, the only difference is instead of selecting [Copy HMI/PLC Block to HMI Block], select [Copy HMI Block to HMI/PLC Block]. [Tag A] is still the destination, and [Tag B] is still the source.

In order to send or receive a coil, select the [Copy Tag B to Tag A] task.

For this task, [TagA] is the destination and [TagB] is the Source. With this task, PLC/Slave data can go into either Tag slot, so data direction is controlled by simply swapping between Tags A and B.


7.

Additional Notes

The HMC to MLC 7448-0215-5 RS232 serial cable is available from our website.
https://maplesystems.com/content/common/controllercables/10280215.pdf

When using Native Ladder mode in both MAPware-7000 projects, the HMC/PLC Master and Slave drivers are alternatives to using Modbus. With the HMC/PLC Master driver, you select the model of your slave device, and are then able to add tags for the remote device using the native MAPware-7000 addresses, which is simpler than calculating the Modbus slave addresses. You will still need to use the data transfer tasks. If using IEC 61131-3 mode, Modbus is the only option.

Scroll to Top