Quick Start

In the following we explain how to use CODESYS on your RevPi device.

This chapter gives you a short tutorial on how to create, configure and load a project. In the startup project BlinkingLight we show you in detail how to set up your RevPi device.

If you want to know more about your RevPi device, you can find detailed information about it here.

More information about CODESYS can be found in the CODESYS Online Help.

Note: If you are working with a RevPi device on which CODESYS is not pre-installed, you will need to activate the license first. The instructions for this can be found in the section Activating the CODESYS license.

Installing Required Software

  • Download the following two packages from our download section locally to your PC:
    CODESYS Control for Raspberry Pi
    Revolution Pi Library for CODESYS.
  • Install the CODESYS Development System on your Windows system.
  • Open CODESYS.

Now the two software packages have to be installed on your CODESYS application.

  • Open the Installer under “Tools/CODESYS Installer”.
  • Before you continue with the Installer, close the main window of your CODESYS application.
  • Click on “Install File” in the CODESYS Installer.
  • Follow the installation steps to install the packages from your PC to your CODESYS application.

The two packages are now listed in the CODESYS Installer under “Installed” and thus installed on your application.

Creating a Project

  • In CODESYS, create a new standard project with CODESYS Control for Raspberry Pi SL.
  • Select CODESYS Control for Raspberry Pi MC SL if your RevPi device has multi-core license support (e.g. Connect+ 16 GB plus CODESYS Multi Core).
  • Right-click on “Device” in the project tab.
  • Click on “Add Device”.

In the following window you can find all RevPi base modules.

  • Right-click on the base module once it is added (RevPi Connect as in this example).
  • Click on “Add Device”.

You can optionally use further KUNBUS submodules.

  • Click with the right mouse button on the base module that you added in the previous step (in this example on “Connect”).
  • Click on “Add Device”.
  • To place a submodule, select the device interface piBridgeLeft or piBridgeRight.
  • Click on “Add Device”.
  • Select the appended device.
  • Click on “Add Device”.

This displays the available modules that can be connected to the left or right of the RevPi Core or Connect, e.g.:
– AIO – Analog input-output module
– DI – Digital input module
– DIO – Digital input-output module
– DO – Digital output module
– MIO – Multi input-output module

PiBridgeEnd is a virtual termination of the PiBridge indicating the end of sub modules on either left or right side of the base module. At this point, a gateway can be attached as further end device.

  • Click with the right mouse button on PiBridgeEnd.
  • Select “Plug Device…”.

You can find all RevPi Gateways here.

  • Double-click on a device for further settings.

IO parameter variables for e.g. the DIO can be found under the tab “Revolution PI DIO Module I/O Mapping”. To use a specific input/output in the CODESYS task, you must name the variable (e.g. Input1, Output1…).

You can start writing your own program! To help you with this, we have created some examples .
Program Example

The MainTask in the following case calls a POU named PLC_PRG in a standard cycle interval of 20 ms. The selected variables can be addressed in this POU where Output1 of DIO module is held high after input1 is high for 5 seconds using a TON timer.

Loading your CODESYS Application on the RevPi Device

Note: If you are working with a RevPi device on which CODESYS is not pre-installed, you need to install the CODESYS runtime system on the RevPi device first. You can find the instructions for this in the section “Installing CODESYS Runtime System on the RevPi Device”.

  • Open the Device Communication Settings tab by double-clicking on the root device in the device tree.

This can be CODESYS Control for Raspberry Pi SL or CODESYS Control for RaspberryPi MC SL, depending on whether you have selected CODESYS Control for single core or multi core support.

  • Select “Scan Network”.

You will now see the devices that are on your local network.

  • Click on “OK”.

After clicking “Login” in the menu bar you will be asked to download the application program for the first time.

Setting up the User Management

If you use CODESYS Control for Raspberry Pi MC SL, you have to set up the user management once at the beginning before loading the CODESYS application on the RevPi device.

  • Confirm the activation of the user management.
  • Enter a username and password.
  • Now you can log in to the device using the credentials you configured.
  • Click on “OK”.
  • Wait until the download is finished.
  • Click on the start button in the menu bar.

The application will now be executed and the online mode for debugging will be made available.

Refer to the example BlinkingLight as a startup example with RevPi CODESYS. This example is located in the folder “%USERPROFILE%\Revolution Pi\Examples”, which is shown as the default path when installing the RevPi CODESYS Library.