You are on page 1of 16

CoDeSys@CHIP Getting Started V2.

12

Getting Started CoDeSys@CHIP Target Visualization

Function Kit FK61-GC01

Order No. 560 306

2007 Beck IPC GmbH

Page 1 of 16

CoDeSys@CHIP Getting Started V2.12

Table of Contents
1 INTRODUCTION ................................................................................................................................ 3 2 THE IEC PLATFORM CONCEPT ...................................................................................................... 4 3 INSTALLING THE IEC PLATFORM .................................................................................................. 5 3.1 INSTALLING THE PROGRAMS........................................................................................................... 5 3.2 INSTALLING THE RTS - SETTING UP YOUR IPC@CHIP HARDWARE ................................................ 7 3.3 INSTALLING THE TSP - SETTING UP YOUR CODESYS PROGRAMMING SYSTEM ................................. 8 4 THE FIRST PROJECT ....................................................................................................................... 9 4.1 WRITING THE FIRST PROGRAM ....................................................................................................... 9 4.2 SETTINGS FOR ESTABLISHING THE CONNECTION .......................................................................... 14 4.3 STARTING THE TARGET SYSTEM .................................................................................................. 15 4.4 STARTING THE PROJECT ............................................................................................................. 15 ADDITIONAL INFORMATION............................................................................................................... 16 A.1 WHERE TO FIND MORE INFORMATION ON THE IPC@CHIP ........................................................... 16 A.2 WHERE TO GET SUPPORT ............................................................................................................ 16 A.3 ORDER NUMBERS ........................................................................................................................ 16

2007 Beck IPC GmbH

Page 2 of 16

CoDeSys@CHIP Getting Started V2.12

Introduction
Welcome to CoDeSys@CHIP, the IEC61131-3 programming environment for the IPC@CHIP family. CoDeSys is one of the most powerful Windows-based IEC61131-3 programming tools available for industrial controllers. The implementation of CoDeSys@CHIP provides the opportunity of programming in IEC61131-3 on the IPC@CHIP platform, including all the IPC@CHIP processor functions in hardware and software. CoDeSys is the name of the IEC61131-3 programming environment running on a Windows PC. Developed by the company 3S Smart Software Solutions GmbH, it is available for free. You can download the setup for the CoDeSys Programming system on http://www.beck-ipc.com/codesys. To get your IPC@CHIP CoDeSys compatible you need a respective Run Time System (RTS). The RTS will be executed on the IPC@CHIP. It manages the whole communication with the CoDeSys Programming System on your Windows PC. The RTS for the IPC@CHIP is also available on http://www.beck-ipc.com/codesys. This document provides a step-by-step guide on how to put the IPC@CHIP and CoDeSys into operation and concentrates on a system level start-up. For more information on hardware and software functionality please also read the IPC@CHIP Documentation and CoDeSys Documentation provided by 3S.

2007 Beck IPC GmbH

Page 3 of 16

CoDeSys@CHIP Getting Started V2.12

The IEC Platform Concept

CoDeSys is a hardware independent Programming System which can be adapted to any industrial controller. To adapt CoDeSys means to create a software collection which describes and handles the hardware of the industrial controller. The software collection which adapts CoDeSys to a specific IPC@CHIP hardware is called the IEC Platform. With CoDeSys@CHIP we provide a powerful and easy-to-use development kit to create IEC Platforms for your specific IPC@CHIP hardware. Also we provide ready-to-use IEC Platforms (e.g. for the Development and Software Evaluation Kits). So you can start programming your IPC@CHIP in IEC61131-3 immediately. An IEC Platform is composed of two components: 1) The TSP (Target Support Package) The TSP is a collection of files which describe hardware and software of a target system (PLC) to the CoDeSys Programming System. Installed on your PC, it represents a target you choose during the creation of the new CoDeSys project. 2) The RTS (Run Time System) The RTS is an application which runs on your IPC@CHIP processor's operating system @CHIP-RTOS. It handles the communication between the IPC@CHIP and the CoDeSys Programming System on your Windows PC. The RTS accepts the IEC application, which is created with CoDeSys, and controls its execution on the IPC@CHIP hardware.

The IEC Platform Concept

The next chapter describes how to install an IEC Platform.

2007 Beck IPC GmbH

Page 4 of 16

CoDeSys@CHIP Getting Started V2.12

Installing the IEC Platform

Before you start working with an IEC Platform, make sure that a valid CoDeSys Version is installed on your Windows PC. You can find the latest CoDeSys Setup on http://www.beck-ipc.com/codesys or on the Homepage of the developer company 3S (http://www.3s-software.com). For programming the FK61-GC01 IPC@CHIP at least CoDeSys version 2.3.9.6 or later is required. As described in the chapter before the IEC Platform contains the RTS and the TSP. Both components have to be installed. The next two chapters describe how to install them. The RTS will be installed on the IPC@CHIP whereas the TSP will be installed on your Windows PC. For your specific IPC@CHIP hardware you can create your own IEC Platform to manage the hardware and peripherals of your IPC@CHIP application. With the IEC Platform Builder, it is very easy to create an IEC Platform. The IEC Platform Builder is part of the CoDeSys@CHIP SDK. For more Information have a look at the CoDeSys@CHIP SDK documentation (http://www.beckipc.com/codesys). However there is no need to create your own IEC Platform. If you use one of the IPC@CHIP development/evaluation kits, you can download a ready-to-use IEC platform. Using such an IEC Platform you have to follow the two simple installation instructions described below. After that you can immediately start programming your IPC@CHIP in IEC61131-3. You can find the IEC platforms for the development/evaluation kits on http://www.beck-ipc.com/codesys.

3.1
3.1.1

Installing the programs


Preparations

Before you can start with CoDeSys and creating your first target visualization you have to do some preparations. Please download the following programs from our homepage http://www.beck-ipc.com/de/download/index.asp touchcal.exe program to calibrate the touch display gclib.exe graphic library for the paradigm compiler gcconverter.exe converter tool for converting fonts, bitmaps, and cursors Font_Vera.zip Truetype font for your PC

3.1.2

Calibrate the touch panel

First open the chiptool, choose the regarding chip, right mouse click and establish an ftp connection to the chip.

2007 Beck IPC GmbH

Page 5 of 16

CoDeSys@CHIP Getting Started V2.12 In the next window you will be asked for a login name and a password. The default login name and password is: ftp In the left window change into the folder were you have extracted the touchcal.zip file. Open the subfolder Touchcal and copy all files of this folder into the root directory of the chip.

After you have copied the program touchcal.exe open the chiptool again and make a telnet connection to the chip. The default login for user is tel and password is also tel. After you have logged in type the following command line into the telnet console: touchcal.exe and follow the instructions on the targets display. Now the touch functionality of the display is calibrated the calibrate values are saved to the chip.ini.

3.1.3

Installing the font Vera.ttf

The font Vera.ttf is published under free licences. When you extract the downloaded zip with the Vera Sans Font and open it you will find the Vera.ttf font and 3 different Vera font sizes which are already converted into the .bgf format. Copy the Vera Sans Font into your windows system font folder. If you know where windows font folder is located you can copy this font directly into the windows font folder. If you do not know the location of the windows font folder open the folder in which you have extracted the downloaded files right mouse click on Vera.ttf and choose copy from the context menu. Now click on Start Settings System controls,

2007 Beck IPC GmbH

Page 6 of 16

CoDeSys@CHIP Getting Started V2.12 and open the folder fonts and insert the font Vera.ttf.

In the next step establish a new ftp connection and create a folder TEST on your chip. CoDeSys uses the folder TEST as default working folder. In the right window of the chiptool FTP-Client change to the folder which contains the Vera.ttf font and three fonts Vera BitStream8, 12, 16. Copy 3 .bgf fonts into the folder test.

3.1.4

Installing the GCLIB and the GCConverter tool.

The gcLib.exe includes the library and the help files for the graphic controller. The setup installs/updates the GCLIB binaries and the GCLIB documentation in the Paradigm installation path in which the compiler is installed. To do this, just execute the gclib.exe in the downloaded file folder. The GCConverter tool is used to convert bitmaps into the .bgb (Beck graphics bmp) format and to convert fonts into .bgf (Beck graphics font) format. Please take a look in the Getting Started FK61GC01 manual on how to convert fonts and bitmaps.

3.2

Installing the RTS - Setting up your IPC@CHIP hardware

The RTS (Run Time System) is an executable file for the IPC@CHIP. Installing the RTS on your IPC@CHIP means to download it to the IPC@CHIP processor's flash and start it. After that your IPC@CHIP is accessible by CoDeSys and ready to run IEC61131-3 applications. Before you can install the RTS on your IPC@CHIP you have to set up the communication with the PC. To do that, have a look into the Getting Started Manual for the IPC@CHIP Embedded Web Controller Family (http://www.beck-ipc.com/chip). There you will find out how to set up the communication and download a program. In general an RTS contains two files: 1) *.EXE The Executable File 2) AUTOEXEC.BAT To Start the RTS (.exe) automatically after reboot

2007 Beck IPC GmbH

Page 7 of 16

CoDeSys@CHIP Getting Started V2.12 Download the executable located in the RTS directory to the flash of your IPC@CHIP (e.g. via FTP or X-Modem). Create an Autoexec.bat file, containing the command line for the RTS to start it automatically. After the download please reboot the target.

3.3

Installing the TSP - Setting up your CoDeSys Programming System

The TSP (Target Support Package) is a collection of files which describe your IPC@CHIP hardware and software to the CoDeSys Programming System. By installing the TSP, the collection of files is handed over to the CoDeSys environment. The installation of a TSP is very easy. You simply have to run the automatic installation file named INSTALL.BAT. Note that you may not install the TSP using the CoDeSys Target Installer! It does not handle relative pathnames correctly. Using it leads to an incorrectly installed TSP. To uninstall a TSP you have to use the CoDeSys Target Installer which you can find in the Windows Start Menu next to the CoDeSys shortcut.

2007 Beck IPC GmbH

Page 8 of 16

CoDeSys@CHIP Getting Started V2.12

The first project

Start the CoDeSys programming system via the Start Menu: Start Programs 3S Software CoDeSys V2.3 CoDeSys V2.3

4.1

Writing the first Program

To get familiar with CoDeSys, you should follow the instructions below to create a simple CoDeSys Target Visualization application and execute it on your IPC@CHIP hardware. The described application performs the following purpose: Create a CoDeSys project which increases a variable from 0 to 255. The value of the variable should be displayed on the target visualization as a bar display and a meter element. Create two touch buttons Start and Reset. With the start button the program starts to count continuously until the reset button will be touched.

4.1.1

Step 1 - Creating a New Project

Starting is easy. Create a new project with the command File New. 4.1.2 Step 2 - Target Settings

For our first project please select the entry which matches your IEC Platform (TSP and RTS) in the combo box Configuration. Depending on which target you have installed, choose FK61_GC01 or FK61_GC01_CM. The only difference between those two targets is that the FK61_GC01_CM has CANopen functionality.

Change to the tab visualization and check that the Web and Target visualization is enabled. 4.1.3 Step 3 - The PLC_PRG POU

In the New POU dialog select the language ST (Structured Text) and retain the other settings. The POU named PLC_PRG is a special one which is cyclically called and executed by the run-time system in operation.
2007 Beck IPC GmbH Page 9 of 16

CoDeSys@CHIP Getting Started V2.12 4.1.4 Step 4 In the right pane click on the tab POUs. Open the PLC_PRG with double clicking on the entry PLC_PRG in the right pane. Type the following lines between the keywords VAR and END_VAR in the upper pane of the PLC_PRG window: VAR byVar: BYTE; bStart: BOOL; bReset: BOOL; END_VAR With Shift + F2 you can open the variable declaration window, or if you use in your program any variable which is not declared the declaration window will open automatically. Now the variable declaration window appears. In this window you set the Type of the variable as BYTE and close the window. In the upper pane of PLC_PRG you can see that your variable byVar is declared as byte. Create two further Boolean variables named bStart and bReset.

4.1.5

Step 5 Inserting a Visualization

In the next step we put the visualization into our project. Therefor you have to click on the visualization tab in the right pane. Mark the folder Visualization, right mouse click and choose Add Object from the context menu. In the next window you will be asked for a name of your visualization. The CoDeSys default name for the visualization is PLC_VISU. In the Visualization window you have a white and a grey area. The white area is the visible area on the display. The borders can be changed in the Target Settings under the tab Visualization. Here the Target and / or the Web Visualization can be enabled or disabled.

4.1.6

Step 6 Visualization Object Meter

Click on the Meter button in the tooltray and place it in the visualization Window. In the window that appears now you can configure the Meter element.

Click on the button Variable/Scale and type in the values for: Scale start 0, Scale end 250, Main Scale 50, Sub scale 25 and Scale format %0.f Then click on the button Font selection and set the font size to 8, otherwise it could be that the font is to large for the visualization element the lettering is not displayed completed eg. 25 instead of 250.
2007 Beck IPC GmbH Page 10 of 16

CoDeSys@CHIP Getting Started V2.12 In the field Variable you assign the variable byVar in the following notation PLC_PRG.byVar. PLC_PRG is the name of the POU in which the variable is declared and byVar is the name of the Variable.

4.1.7

Step 7 - Visualization Object Bargraph

Now place the visualization element Bar graph into your visualization and configure it in the same way as you did it for the meter element.

4.1.8

Step 8 - Visualization Object: Buttons

Insert a button into your visualization. By double clicking on this button you configure the properties of the button. Change to the category Text and write Start into the text field and choose 16 as font size for the text. In the category Input you can set the behaviour of the button and the actions that should be executed when the button is pressed. Here in this case we want a toggle behaviour, this means if you touch the button the value of the variable bStart changes from FALSE to TRUE. When you release the button the value bStart is still true until you touch the button again. A Tap variable changes its value as long as you press the button. When you release the button the value changes back to the original value. We use the variable bStart which we have declared before as the Toggle variable
2007 Beck IPC GmbH Page 11 of 16

CoDeSys@CHIP Getting Started V2.12

The second Button is the reset button with which the counter value of the program can be set to 0. So write in the text field for the second button Reset and in the category input chose Tap variable, assign the variable bReset to this button by writing PLC_PRG.bReset into the according field.

4.1.9

Step 9 Programming the POU PLC_PRG

Now change back to the PLC_PRG window. In the empty window write the following lines: IF(bReset = TRUE)THEN bStart := FALSE; byVar := 0; END_IF IF(bStart = TRUE) THEN byVar := byVar + 1; END_IF In the first if case the reset button will be checked. If the reset button is pressed the start button will be set to FALSE and the value of byVar will be set to 0. In the second if case the Start button will be checked, if the button is pressed the program starts counting until the reset button is pressed.

4.1.10 Step 10 Multitasking Settings CoDeSys offers the opportunity to create IEC-tasks. These tasks will be mapped to operating system tasks (RTOS-tasks). Several jobs can be managed simultaneous by a set of (cooperating or competing) IEC-Tasks. These tasks are prioritized and can be freewheeling, triggered by a timer or activated by a boolean flag. To give an illustration of Multi-Tasking in IEC we will modify the time settings of the PLC_PRG_TASK. First make a copy of the project and save it to harddisk. Switch to the program in CoDeSys and select the task configuration in the resource tab. All task management is done here.

2007 Beck IPC GmbH

Page 12 of 16

CoDeSys@CHIP Getting Started V2.12

Now choose the PLC_PRG_TASK and change the Task priority from 1 to 10 and time interval from 10ms to 100ms.

The PLC_PRG_TASK has priority 10 (0 = highest, 31 = lowest) and is executed whenever no other program with a higher priority is ready. For the Codesys Target visualiztion Codesys creates 3 tasks: PLC_PRG_TASK with a time interval of 10ms and activated watchdog VISU_TASK time interval 200ms VISU_INPUT_TASK time interval 50ms

In the VISU_TASK manages the drawing on the display, the VISU_INPUT_TASK manages the touch functions.

4.1.11 Step 11 - Build Project Now save your program and build the project with the menu command ProjectRebuild all or the <F11> function key. In the message window at the bottom right, 0 errors should be reported after the build procedure. If not, check that all the entries have been correctly made. The reported error may also help.
2007 Beck IPC GmbH Page 13 of 16

CoDeSys@CHIP Getting Started V2.12

4.2

Settings for Establishing the Connection

A small number of settings must be made before we can establish the connection to the target system. For this purpose open the menu command Online Communication parameters.

Enter an appropriate name for the connection at the new dialog and select a connection (Serial or TCP/IP). In the window Communication Parameters click on the New button and choose the TCP/IP (Level2 Route) protocol and click the OK button

A further dialog window opens. The previously chosen name for the communication must be selected under 'Channels'. In the field 'Value' (enter with double click) the IP-Address of the IPC@CHIP has to be entered. The other standard settings such as 'Port' remain unchanged.

Editing of the value for "Address" must be terminated by pressing ENTER/RETURN on the keyboard (not by pressing the "OK"-Button), otherwise the new value will not be adopted. When TCP/IP configuration is done the communication with the IPC@CHIP can be established to transfer the project as soon as the Runtime System on the IPC@CHIP is started. Note: If you want to modify the IP configuration of your IPC@CHIP target, you can do that by using the Modul Parameters dialog in the PLC Configuration in CoDeSys. This dialog shows all IPC@CHIP
2007 Beck IPC GmbH Page 14 of 16

CoDeSys@CHIP Getting Started V2.12 processors found on the local network. It also allows modification of the IP, Netmask or Gateway addresses, or enabling DHCP can be set with the help of the integrated CHIP Find Dialog Tool. To use this integrated tool open 'PLC configuration' under Resources. Select the IPC@CHIP module and open the 'Module Parameter' window. All the IPC@CHIP processors present on the local network are listed. Select the IPC@CHIP allowing adapting the configuration. If you want to connect the target via serial connection you have to choose the COM port of your PC which the Nullmodem cable is connected to. If you want to connect the target via TCP/IP you have to choose the IP address of the target. After that close the communications parameters dialog with OK.

4.3

Starting the Target System

To start the IPC@CHIP target system you simply have to switch the power supply on.

4.4

Starting the Project

The program shall demonstrate some functions of the CoDeSys Target Visualization and is not designed for industrial usage. Please read this chapter once, before you try to figure out how to handle the IEC-program you created by means of the instructions before. The connection to the target computer will be established using the menu command Online Login and you will be asked to download the program you just created. By means of the visualization you can control the IEC-program. After downloading the program, your visualization should look like this:

Now start the IEC-program by selecting Online Run from the CoDeSys menu (if you want to work in simulation mode, the option 'Online' 'Simulation' must be activated). Now press the "Start"-button on the display and visualization elements bar graph and meter will show the actual value of the variable byVar. If you press the Start button again the counter stops until the Start button is pressed again. With the Reset button the both visualization elements are set to 0.

2007 Beck IPC GmbH

Page 15 of 16

CoDeSys@CHIP Getting Started V2.12

Additional Information A.1 Where to find more information on the IPC@CHIP


Check our website at http://www.beck-ipc.com Here you will find application interfaces, tools, examples, new @CHIP-RTOS versions, etc. Remember that the IPC@CHIP is an evolving product. It makes sense to visit the IPC@CHIP home page regularly.

A.2 Where to get support


There are two possible ways to get support: 1. To get support please use our newsgroup on the Internet: You can visit the IPC@CHIP forum at http://www.beck-ipc.com/ipc/support/forum. Here you will find a lot of answers to customer problems and you can also add your own ideas and questions. Please use email as the main way of communication. This not only reduces the time you spend on the phone, but also allows us to easily manage the questions and identify problem areas. Important or frequent questions and the corresponding answers are becoming part of our Frequently asked question list that is published on the Internet. 2. To get support via email: Please send your emails with your request to mailto:support@beck-ipc.com You will find also a lot of answers in our Frequently Asked Questions documentation at http://www.beck-ipc.com/ipc/support.

A.3 Order numbers


Most parts of the Function Kit FK61-GC01 can be ordered separately. Please visit our online shop. These are the order numbers. Part FK61-GC01 Development Kit GC01 Graphic-Module DK61 Development Kit DK60 Development Board ZK14 serial null-modem cable PSE10 power supply Paradigm C++ Beck IPC Edition Part number 560306 560307 542750 542751 195837 538934 541522

The SC123/SC143 processors and any part of the DK61 Development Kit can be ordered separately. Please visit our Online Shop. The order numbers are: CHIP: SC123 SC123 LF (lead free) SC143 SC143 LF Without IEC License: 541094 543257 541529 543258 With IEC License: 541528 543259 541530 543260

End of this document

2007 Beck IPC GmbH

Page 16 of 16

You might also like