This is an old revision of the document!


Connecting to UniPi extension

The UniPi extensions are convenient way how to extend the number of inputs and outputs at one location, or make accessible at another one.

The communication between controller and extension is via RS485 ports. The extension acts as a Modbus slave, which has an extended support in the Mervis.

You need only two cables to connect the UniPi extension to the controller. Just interconnect the RS485-A port on the controller to RS485-A port on the extension and RS485-B on the controller to RS485-B on the extension.

For communication to work, you have to have identical serial port parameters on both sides - speed, data bits, stop bits and parity. Also each extension unit has to have unique Modbus address. You can set those in two ways: by HW DIP switches, or in the Mervis.

DIP switches

The DIP switches are small levers, which can be pushed down, or pulled up. When the lever is pushed down, the function is enabled.

On model xS10, xS30 and xS40, you can set the speed, parity and address by DIP switches. On the xS50, only the DIP switches for address are present on the unit.

The first DIP switch is called RS485-END. It is for connecting and disconnecting internal 120ohm resistor between RS485-A and RS485-B for proper termination of the RS485 bus. You will have to enable this option when the extension is last device on the bus. Typically, this applies to very long buses, over several 100s of meters.

Second DIP switch is omitted, without any function.

The third to sixth DIP switch is for setting address. With these switches, you can set address from 0 - 15 in binary format.

Address DIP sw. 3 DIP sw. 4 DIP sw. 5 DIP sw. 6
0 OFF OFF OFF OFF
1 ON OFF OFF OFF
2 OFF ON OFF OFF
3 ON ON OFF OFF
4 OFF OFF ON OFF
5 ON OFF ON OFF
6 OFF ON ON OFF
7 ON ON ON OFF
8 OFF OFF OFF ON
9 ON OFF OFF ON
10 OFF ON OFF ON
11 ON ON OFF ON
12 OFF OFF ON ON
13 ON OFF ON ON
14 OFF ON ON ON
15 ON ON ON ON

The seventh switch is for setting speed of the serial bus between 19200bps (OFF state) or 9600bps (ON state).

The eighth switch is for setting parity of the serial bus between Even (OFF state) or None (ON state).

The xS50 has DIP switches only for the address. Other parameters of the serial port has to be configured in the software. The default settings are as follows: 19200, 8 data bits, 1 stop bit and no parity.

Software settings

The connection parameters can be also set in Mervis. The HW settings takes precedence, so in order to SW settings take place you have to set the address to 0. The rest will be described later in this tutorial.

Let's assume you have a basic project in Full mode, you are attached to the controller, you have Executable project with one FBD program and this program is configured as a sole Task of the PLC. And you Set Autogen on the UniPi device. Your workspace should look like this:

As we stated previously, the communication with UniPi extension is via ModbusRTU. So create a channel by right clicking on the PLC in the Left panel and selecting the Add Channel option.

A new channel will appear under the PLC. Select it and in the Properties panel change the Name to something more descriptive, like ModbusRTU. Also change the Protocol to Modbus.

Leave the Link Protocol to Serial, but change the Port Number to serial port on your PLC. Our testing UniPi Neuron L503 is equipped with two RS485 ports, and we will use the one on the 1st group.

We will also change the Baud Rate (a.k.a speed) to 19200, as it is a default value for UniPi's extensions.

Now we can add the device and we can do it in two ways. You are used to right click on the channel name and then clicking on the Add Library Device and then selecting the proper device from the list. This will work, but with UniPi extensions, you can let the Mervis detect all the units on the bus automatically and add all of them at once.

When new channel is added, the autodetection will not work until you deploy the solution, because the PLC doesn't know this channel yet.

To autodetect the devices, right click on the channel name in Left panel and in the context menu click on the UniPi - Modules autodetect.

You will be probably presented with dialog warning you, that the autodetection needs to be executed while the PLC is in the Commissioning mode. The Mervis will offer you to switch to this mode and after the detection it will switch back to the previous mode.

Next dialog will ask you for the range of Modbus ID's the autodetect will look for. You can leave the default 1 - 15.

The detection has finished and you can see a list of UniPi extensions on your RS485 bus. You can tick the Import checkbox and import their definitions.

And confirm the restore to previous mode.

A new device(s) will appear under the channel. You should rename them to something more descriptive, e.g. by their purpose or location.

Also run Set Autogen on the device in order to generate all the variables which the extension has.

Turn on the Debugging and select the Variable browser tab in the Main window. Under the name, search for the name you gave the extension (in our case the boilerRoom). In the browser, you should now see only the variables for the extension.