Skip to content

CODESYS

CODESYS is an integrated development environment (IDE) for programming controller applications in accordance with the international industrial standard IEC 61131-3. The Pigeon for CODESYS Control package is available and provides support for all models of Pigeon computers.

Getting Started

Introduction

This guide provides an overview of the first steps in using CODESYS with Pigeon computers.

Installing CODESYS on Windows

You can download the CODESYS Development System from the CODESYS Store. Registration is required to download the software, but the CODESYS Development System is free. Pigeon computers have been supported by the CODESYS Development System since version 3.5.11.0.

codesys_001

After downloading, run the installer and accept all default settings.

Installing the Packages

First, download CODESYS Control for Raspberry Pi SL from the CODESYS Store. Pigeon computers have been supported by CODESYS Control for Raspberry Pi SL since version 3.5.11.0.

codesys_002

Next, download CODESYS Control for Pigeon. This package provides support for the Pigeon computers family (RB100, RB300, RB100-CM3, RB300-CM3). You can download CODESYS Control for Pigeon from our server at CODESYS_PIGEON_1.0.0.0.package or the CODESYS Store.

pigeon_control_codesys

Then, open the CODESYS Development System and select Tools → Package Manager.

codesys_01

Click the Install button and select the CODESYS Control for Raspberry Pi package.

codesys_03

Accept the license agreement and the default settings.

Next, install the CODESYS Control for Pigeon package in the same way. CODESYS Control for Pigeon is free.

codesys_04

Restart the CODESYS Development System.

Installing CODESYS Runtime on the Pigeon

First, enable the SSH server on the Pigeon. To do this, run raspi-config in the Pigeon console, select Interfacing Options → SSH, and then select Yes. Reboot the Pigeon. In the CODESYS Development System, select Tools, then Update Raspberry Pi. Enter the username and password (default: pi/raspberry).

codesys_05

Enter the IP address of your Pigeon (you can find it by using the ifconfig command in the console) and click Install. Reboot the Pigeon.

codesys_06

That’s it! You’re now ready to create and load your first project.

First Project

In the CODESYS Development System, select File → New Project..., then in the Projects category, choose either Pigeon RB100 project or Pigeon RB300 project, depending on the device you are using.

codesys_07

The new project will be created. Below, you can see screenshots of the RB300 template project.

codesys_11 codesys_12

Example Projects

The CODESYS Control for Pigeon package also includes example projects for RB100 and RB300. The default directory for these projects is: C:\Users[User Name]\CODESYS Control for Pigeon\1.0.0.0\Examples. To open a project, select File → Open Project...

codesys_13

The following images show screenshots from the example projects.

codesys_09 codesys_08

Downloading the Project to the Pigeon

In the CODESYS Development System, click on Device.

codesys_14

Click Scan Network. The Pigeon should be detected.

codesys_15

Select it and click OK.

codesys_16

You can also manually enter the Pigeon’s IP address.

codesys_17

Next, click Online → Login, then Debug → Start.

codesys_18

You can open a web browser and enter the Pigeon’s IP address followed by port 8080 (for example, 192.168.1.17:8080). You will see the following page:

codesys_10

Updating to the Newest Version

If your compiler version is newer than the current version in the project, select options similar to those below when opening the example project.

code_sys_up1

Then, update the device version of the project to the latest version.

code_sys_up2 code_sys_up3

CAN bus

This section provides instructions on how to use the Pigeon CAN bus in CODESYS

First, modify the CODESYS configuration file /etc/CODESYScontrol_User.cfg as follows:

[SysCom]
;Linux.Devicefile=/dev/ttyS

[CmpBlkDrvCom]
;Com.0.Name=MyCom
;Com.0.Baudrate=115200
;Com.0.Port=3
;Com.0.EnableAutoAddressing=1

[CmpSocketCanDrv]
ScriptPath=/opt/codesys/scripts/
ScriptName=rts_set_baud.sh

[SysProcess]
Command.0=shutdown

[CmpApp]
Bootproject.RetainMismatch.Init=1
Application.1=PIGEON_CANmaster

Next, add the following bash script at /opt/codesys/scripts/rts_set_baud.sh:

#!/bin/sh
BITRATE=`expr $2 \\* 1000`
ifconfig $1 down
echo ip link set $1 type can bitrate $BITRATE
ip link set $1 type can bitrate $BITRATE
ifconfig $1 up

Then, modify the script permissions:

$ sudo chmod +x /opt/codesys/scripts/rts_set_baud.sh