This is an old revision of the document!


Connecting multiple Unipi PLC’s through the SSCP protocol

Do you need to use one Unipi PLC to read from or write to I/O’s of an another Unipi PLC? The SSCP communication protocol will allow you to do exactly that. In more complex projects the SSCP can be also used to relay variable values or data from various sensors. This tutorial will show you how to set up the SSCP.

What is required?

Create a new project in the Full Mode.
The next step is to attach all PLCs we will use for the SSCP communication. Right-click on System and choose Add controller. Repeat for the second PLC.
To keep the project as comprehensive as possible, we recommend naming each part of the project.

  • Unipi #1: PLC_Master
  • Unipi #2: PLC_Slave
  • channel: Modbus_TCP_m (master)
  • channel_0: Modbus_TCP_s (slave)


Each PLC will need its own executable project. Right-click on Executable projects and choose Add new project.
For the sake of clarity, name both projects as SSCP_M and SSCP_S (master, slave).
Right-click on the SSCP_M project and choose Add and then Add program. Name the newly created program as main_m. Repeat these steps for the second executable project as well (SSCP_Smain_s).
Your settings should now look like the picture below:
Double-click on PLC_Master and right-click into the blank space. Then click on Add task. As before, repeat this step on PLC_Slave.
Save the project and compile it by clicking on Build solution.
An error message will appear, as the project is still not complete at this point. However, you can already map both programs to tasks. In the Program mapping column double-click in the blank space. Then add main_m into PLC_Master and main_s into PLC_Slave.
If needed, you can now add more channels. For the purpose of this tutorial, we will create an additional channel for the PLC_Master and name it SSCP_TCP_m.

For advanced users: Create a 1-Wire channel for each PLC
Don’t forget the naming – it is necessary to distinguish between PLC_Master a PLC_Slave. Check the following picture for reference:
Right-click on the SSCP_TCP_m channel and choose Add device.
Name the device as slave_PLC. If you now highlight the device, the Properties, a panel will appear in the right screen column. Set all relevant properties according to the picture below. You can find all necessary values in Properties of the PLC_Slave.

Enabling communication through a secure SSCP connection

In the Mervis IDE/OS v2.3.0 and newer you can connect multiple Unipi PLCs using a secure SSCP connection (which we strongly recommend). The configuration is very easy but must be performed on all Unipi PLCs used in your project if you did not so already. Follow the Secure connection to a PLC guide.

In the newly created device, create two groups and set one as read and the second as write. Name them as such.
Your groups should now look like this: System
Add a single data point for each group by right-clicking on them and choosing the Add data point.
Upon selecting the data point, its Properties will appear in the right column. Enter the settings as on the picture below:
Now we need to use the Autogen function. Right-click on each device for each channel and click on Set Autogen.
Keep in mind that all devices for PLC_Master must be assigned to the SSCP_M project and all PLC_Slaveto the SSCP_S project.
Autogen will create two generated.Mixed.st files, one per each project (eg. one for each PLC).
We now need to enter a source variable for each of the data points. Double-click on slave_PLC and select the slave_master__DI1_DO1 data point. In the Properties column, scroll to the bottom and find the Source variable tab. To set up a variable we need to Build the solution first. The project is still not complete at this point, so expect an error message to appear.
However, during the compilation attempt, the variables created by Autogen will be uploaded. That allows us to map the source variable.

For the slave_master__DI1_DO1 we need the DI_1.01 on PLC_Slave.
For the master_slave__DI1_DO1 data point, use the same PLC, but select the DO_1.01_w source variable instead. By finishing these steps the basic settings are now complete.

The next step is to insert the variables into a program. Check the picture below – the left side is for reading values (slave → master), the right side is for writing them (master → slave). If you do not see any variables in the list, Build the solution and the variables will appear.

Step-by-step description:

  1. Ordered List ItemAdd the slave_master__DI1_DO1 to the input side (left), the DO_1.01_w (PLC_Master) to the output side (right) and connect them
  2. Ordered List ItemAdd the master_slave__DI1_DO1 to the output side (right), DO_1.01 (PLC_Master) to the input side (right) and connect them.

Then click on Deploy solution.

First, detect both 1-Wire sensors and then use the Set autogen. The detailed guide for this step is available in the Attaching 1-Wire devices tutorial

Create two additional data points and name them as on the following picture:
Add a data type and a group for each. For these two variables, set the Autogen manually through the Properties panel – don’t forget to choose the target project. After that, map the source variable.
Repeat for the second variable:
Let’s move to main_s. Double-click on main_s.Program.fbd and create two global variables. As before, inputs are on the left and outputs are on the right.
Name the input variable as follows:
The output variable is needed only if the main_s does not contain a logic that would process the variable. The reason for this is the Mervis requires for the output variable to be „used“ – in the opposite case, it will not be included in the solution. Connect both global variable blocks and name them accordingly:
Move to the main_m. Double-click on the main_m.Program.fbd a vložte proměnné vytvořené v slave_PLC. (read on the left, write on the right)
Additionally, insert an input variable with the 1-Wire sensor output (PLC_Master) and connect it to the output variable as follows:
The project is now good to go. Deploy it to both PLCs by clicking on Deploy solution.
Start the Debugging and go into the Variable browser. Enter master or slave into the variable filter to filter out only those variables important to us:

The project is now complete. If all steps were performed correctly, both PLC’s are now set to write the first PLC‘s DI_1.01 value to D0_1.01 output of the second druhého PLC.

If you opted for the advanced user part, both PLC also mutually Exchange temperature values from the 1-Wire sensors with the communication still controlled by PLC_Master)

The whole logic and most of the settings are located on PLC_Master.

Possible SSCP applications → reading inputs or writing onto outputs of a different PLC

Advanced applications
  • Multiple PLCs sharing a single sensor
  • Program variable sharing: PLC_Master monitors a single particular bool variable on PLC_Slave. If the variable is set to TRUE on PLC_Slave, the PLC_Master reacts by updating another variable on the PLC_Slave. PLC_Slave also continues to process the variable according to its main_s program.
  • PLC_Master can send the variable into PLC_Slave each second – however, this will result in clogging up the communication and slow response of the project. This solution was used for this tutorial simply because the logic in PLC_Slave is in this case irrelevant.