<< to CrossControl homepage

Support & Service Center

CoDeSys Programming

We recommend to refer also to the following web-pages for CoDeSys-related questions and problems:

Switching CODESYS Visu page/frame with HW buttons on CCpilot VI2

Default you are able to change between Visu pages by changing the Default Hotkeys in the Visualization Manager settings. For CCpilot VI2 the assigned keys are, C,D,E,F.

This application shows how the state of the hardware buttons on the CCpilot VI2 can be read and used in the GUI. By clicking the different HW buttons a new Visu Frame/page is shown. The project uses the cc-aux interface to handle the states of the buttons. The state is then available from the GUI.

Extract from included PLC_PRG
// Read the state of the hardware buttons from cc-aux api with Button_GetValues.
IF firstTime THEN
	eError := About_GetNrOfButtons(numbuttons=>numberOfButtons );
	firstTime := FALSE;
IF eError = ERR_SUCCESS AND numberOfButtons > 0 THEN
	eError := SoftKey_GetStatus(value=>frontButtonValues);
	CASE frontButtonValues OF
		1: framePage := 0; 
		2: framePage := 1; 
		4: framePage := 2; 
		8: framePage := 3; 
Environment and Versions: 

ARM imx6 Linux

Applies to version: 
OS Image

File Utility Example

This example shows several possibilities of writing and reading files as well as working with directories, synchronous function calls are used.

Applies to version: 
CoDeSys Version 3.5.x or higher

Keypad/Numpad Example

Below is an application note and example to show how to integrate an on-screen numpad or keypad for user input to any visualization

PDF icon keypad_numpad.pdf117.73 KB
Binary Data keypad.projectarchive26.88 MB
Applies to version: 
CoDeSys Version 3.5.x or higher

Date and Time Utility

Below is an application note and example to show a method of using date and time variables. Synchronous functions are used and different visualizations are implemented to display the current system time.

Applies to version: 
CoDeSys Version 3.5.x or higher

Auto update CODESYS application from USB

This information assumes that you are familiar with working in Codesys.
The dcoument attached to this article, covers the situation when you already have a working development environment and the runtime is already installed on the target unit. It will also describe how you create files on an USB-stick that will be automatically installed in the display, when the USB is inserted in an USB-port.

The ZIP-file attached contains a copy of the cc-auto.sh and an install-screen used in the script.

It is valid for all our iMX5 displays (XA/XS, VC/VA). For ou iMX6 displays (VS/VI2) there are some things that differ.

Make sure that you look in the correct document attached at the bottom of this article!

Step 1: Update Codesys application on target device

Make all changes and updates to your CODESYS application in your development environment and test it on your target display.

Step 2: Create Boot application

When you have finished 'Step 1', you want to deploy the updated application to your other target display units, so you need to create a Boot Application.

Step 3: Automatic installation from USB

This section describes how to create an automated way to update several displays with the same Codesys application. The files will be saved on an USB-stick and automatically installed when the USB is inserted in the display.

If you have the possibility, try the auto-installation on one of your own displays, before doing it on the field to be sure that the update is working correctly!

Also be aware of the fact, that if you turn off the autostart of the CC settings screen (StartupGui), you won’t be able to ‘see’ the IP address of the display!
The advice is to set a static IP address on your unit so you will be able to find it and so you can connect to it!

Applies to version: 

CODESYS - Portrait Mode

This article will describe how to use a CODESYS application in portrait mode on a CCPilot display.

This article was tested with the following display and settings:

  1. CCPilot VA
  2. CODESYS v3.5.9.3
To rotate the display:
  1. Log into the display with Putty and move to the '/opt/CoDeSysControl' directory
  2. Type 'nano codesys-launch.sh'
  3. Scroll down in the file to where it shows 'QWS_COMMANDLINE_PARAM="-qws";'
  4. Edit the line so it now reads 'QWS_COMMANDLINE_PARAM="-qws -display transformed:rot90";' where the '90' is the degree of rotation
  5. Press 'Ctrl + x' to exit and reboot the display
To setup the CODESYS project:
  1. You will need to modify the Visualization resolution to be the portrait mode resolution of the display. If you have created your visualization in landscape orientation this will require some slight modification and adjustment.
    - VC/VA/XA: 480x800
    - XS: 768x1024
    An example project is posted below for the VC/VA/XA display resolutions.
Note: While this was tested on a VA display it will likely work with all displays using CODESYS v3.5.9.3. Older versions of the runtime may also work although each hasn't been tested..

Binary Data rotated_visu.projectarchive20.63 MB
Environment and Versions: 

VC / VA CCAux Issues Fix

For some versions of the OS on the VC and VA displays there are issues when using CODESYS and the CCAux libraries.  These usually present by the CCAux function call returning a 'not supported' error.  These may only present for some CCAux functions.  

These errors are due to libraries being installed in two seperate places and libraries from the wrong location being used.  If you suspect you may have these issues please use the auto script below.  The auto script will fix the issue of libraries being installed in multiple places.  Using this script shouldn't hurt the display or your application.  In short, it removes the ccaux libraries from '/opt/lib' and makes sure libraries in '/usr/lib' are up to date.

To use:

  • Download and extract the 'vc_va_ccaux_fix.zip' file to the root directory of a USB and insert it into the display
  • Wait for the display to reboot.  Once it begins rebooting remove the USB.

After the display has finished rebooting the library issue should be corrected.

Package icon vc_va_ccaux_fix.zip122.65 KB
Environment and Versions: 


XM2 CODESYS - Full Screen and removing the mouse pointer

By default, CODESYS on the XM2 will show up as a window and instead of taking up the entire screen.  There will also be a mouse pointer shown.  This article shows how the user can make CODESYS appear full screen and without a mouse pointer.

  • Log into the device
  • Type 'cd /usr/bin'
  • Type 'mount -o remount, rw /'
  • Type 'nano mini-x-session'
  • Scroll down with the arrow keys and modify the last line of the file to say 'exec matchbox-window-manager –use_cursor no –use_titlebar no'
  • Once complete, save the file with ctrl+x. It will ask you if you want to save and overwrite the file.
  • Type 'mount –o remount,ro /'
  • Reboot the display by typing 'reboot'

Once rebooted, CODESYS should appear as a full screen application without a mouse pointer. 

Note: This seems to cause the CODESYS window to be offset slightly.  You can fix this by making the y position of the CODESYS application a negative value.



Environment and Versions: 



We have written a small Qt application which allows the user to show PDF files from within CODESYS.  This works by opening the Qt application which appear on top of the CODESYS application.  You can format the Qt applicatoin to be different sizes on the screen so it doesn't need to take up the entire screen and can instead take up only a portion of the screen.  The attached CODESYS project shows an example of this.

The Qt application will import PDF files from a USB drive inserted into the display.  The files will be converted to a .jpg file which the appliction will use to show the "PDF".  We use .jpg files instead of the native .pdf format due to many of the displays taking a long time to open and move around a true PDF file.  This is not the case for .jpg files which the display will open quicly once the conversion has been made.  The conversion process may take some time though depending on the size of the PDF file being converted but this process will only happen once.  Once the PDF file has been converted and imported (by the tool) it will be stored on the display for future viewing.

Instructions for use:

  • Download the 'pdfviewer_v0.0.2.tar.gz' and the 'codesys_pdf_viewer_app.tar_.gz' files attached to this article and copy them to the '/opt/ directory of the display
  • Log into the display through the terminal and navigate to the '/opt' directory.
  • Type  'tar -xf pdfviewer_v0.0.2.tar_.gz -C /opt' and hit enter
  • Type 'ldconfig -C /opt/etc/ld.so.cache' and hit enter
  • Type 'tar -xf codesys_pdf_viewer_app.tar_.gz' and hit enter
  • Type 'chmod +x CoDeSys_PDF_Viewer' and hit enter
  • The PDF viewer requires the Qt runtime be installed on the display. Install the latest LinX runtime available in the LinX software page.

Now download the 'codesys_pdf_example.projectarchive' file and open with the CODESYS IDE.  The example applicatoin was built for the ARM display with a 800x480 resolution (XS / VA / VC) so if you are using another display type modifications may be necissary.  This example CODESYS application should demonstrate how the Qt PDF application is opened within CODESYS.

Also attached to this article is the source code for the Qt PDF project ('codesys_pdf_viewer.tar_.gz').  It may not work perfectly in all applications so changes to the code may be neccissary.

Note: This will only work with the QWS windowing system.  If using X-Windows or another system this project will not work.



Video in CODESYS

To show video feed from a connected video camera on our devices you should use the CCAux api.

Below you will find a basic example how to show a Video feed in CODESYS (example on a CCpilot VC). as well as an example of how to switch between multiple camera inputs or feeds.
For extended functionallity more information is found in the CCAux documentation.


	result: eErr;
	initVideoDevice_1: BOOL := TRUE;
	channel: VideoChannel := Channel_1;
	videoDevice_1_Active: BOOL := TRUE;
	activeVideoDevice: VideoDevice;
	horizontalPosition_Dev1: UINT := 0;
	verticalPosition_Dev1: UINT := 0;
	width_Dev1: UINT := 800;
	height_Dev1: UINT := 600;
	horizontalScaling_Dev1: REAL := 1;
	verticalScaling_Dev1: REAL := 1;
	showVideo: BOOL := TRUE;
	Standardd: CCAUX.VideoStandard;
IF showVideo THEN
	result := Video_ShowVideo(deviceNr:=activeVideoDevice, show:=TRUE);
	showVideo := FALSE;	
IF initVideoDevice_1 THEN
	IF Video_Init(deviceNr:= VideoDevice_1) = CCAUX.ERR_SUCCESS THEN		
		result := Video_SetActiveChannel(deviceNr:=VideoDevice_1, channel:= Channel_1);
		result := Video_SetVideoArea(deviceNr:=VideoDevice_1, topLeftX:=horizontalPosition_Dev1, topLeftY:=verticalPosition_Dev1, bottomRigthX:=horizontalPosition_Dev1 + width_Dev1, bottomRigthY:=verticalPosition_Dev1 + height_Dev1);
		result := Video_SetScaling(deviceNr:=VideoDevice_1, horizontalScaling:=horizontalScaling_Dev1, verticalScaling:=verticalScaling_Dev1);
		result := Video_GetVideoStandard(deviceNr:=VideoDevice_1 , standard=>Standardd);		
	initVideoDevice_1 := FALSE;			

Environment and Versions: 

CCAux 2.7.3 and newer

ARMv7 platform