Application Note Access Keyboard of CDSA-D3-RV

19
100340 Application Note 0 Access Keyboard of CDSA-D3-RV Get access to hardware keyboard within a CODESYS project with CODESYS Remote-Target-Visualization on Festo PLCs CDSA-D3-RV

Transcript of Application Note Access Keyboard of CDSA-D3-RV

Page 1: Application Note Access Keyboard of CDSA-D3-RV

100340

Application Note

0

Access Keyboard of CDSA-D3-RV

Get access to hardware keyboard within a CODESYS project with CODESYS Remote-Target-Visualization on Festo PLCs

CDSA-D3-RV

Page 2: Application Note Access Keyboard of CDSA-D3-RV

Title ...................................................................................................................... Access Keyboard of CDSA-D3-RV

Version ............................................................................................................................................................. 1.10

Document no. .............................................................................................................................................. 100340

Original .................................................................................................................................................................en

Author ............................................................................................................................................................. Festo

Last saved ............................................................................................................................................ 02.06.2021

Copyright Notice This documentation is the intellectual property of Festo SE & Co. KG, which also has the exclusive copyright. Any modification of the content, duplication or reprinting of this documentation as well as distribution to third par-ties can only be made with the express consent of Festo SE & Co. KG.

Festo SE & Co KG reserves the right to make modifications to this document in whole or in part. All brand and product names are trademarks or registered trademarks of their respective owners.

Legal Notice Hardware, software, operating systems and drivers may only be used for the applications described and only in conjunction with components recommended by Festo SE & Co. KG.

Festo SE & Co. KG does not accept any liability for damages arising from the use of any incorrect or incomplete information contained in this documentation or any information missing therefrom.

Defects resulting from the improper handling of devices and modules are excluded from the warranty.

The data and information specified in this document should not be used for the implementation of safety func-tions relating to the protection of personnel and machinery.

No liability is accepted for claims for damages arising from a failure or functional defect. In other respects, the regulations with regard to liability from the terms and conditions of delivery, payment and use of software of Festo SE & Co. KG, which can be found at www.festo.com and can be supplied on request, shall apply.

All data contained in this document do not represent guaranteed specifications, particularly with regard to func-tionality, condition or quality, in the legal sense.

The information in this document serves only as basic information for the implementation of a specific, hypo-thetical application and is in no way intended as a substitute for the operating instructions of the respective manufacturers and the design and testing of the respective application by the user.

The operating instructions for Festo products can be found at www.festo.com/sp .

Users of this document (application note) must verify that all functions described here also work correctly in the application. By reading this document and adhering to the specifications contained therein, users are also solely responsible for their own application.

© Festo SE & CO. KG, D-73726 Esslingen, 2021 Internet: http://www.festo.com

Page 3: Application Note Access Keyboard of CDSA-D3-RV

Table of contents

1 Components/Software used ....................................................................................................................... 5

2 Introduction ................................................................................................................................................ 6

3 Setup CODESYS Project .............................................................................................................................. 7

3.1 Preparation.................................................................................................................................................. 7

3.2 Create CODESYS Project .............................................................................................................................. 7

3.3 Add Library to Project .................................................................................................................................. 8

3.4 Visualization Manager ................................................................................................................................. 9

3.5 Remote Target Visualization ...................................................................................................................... 10

3.6 Create Visualization Page .......................................................................................................................... 11

3.7 Setup Start Visualization Page for Remote Target Visualization ............................................................... 11

3.8 Add Keyboard Access to Visualization ....................................................................................................... 12

3.9 Map Variables to Frame ............................................................................................................................. 13

3.10 Select Device and run Application ............................................................................................................. 14

3.11 Add Simulation Frame within Web Visualization ....................................................................................... 14

4 Additional ................................................................................................................................................. 16

4.1 Client Handling .......................................................................................................................................... 16

4.1.1 Range of IDs ................................................................................................................................. 16 4.1.2 Access Client ID ............................................................................................................................ 17 4.1.3 Application usage ........................................................................................................................ 18

4.2 Call Functions within Visualization ............................................................................................................ 18

Page 4: Application Note Access Keyboard of CDSA-D3-RV

Table of contents

Page 5: Application Note Access Keyboard of CDSA-D3-RV

Components/Software used

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 5 of 19

1 Components/Software used

Type/Name Version Software/Firmware Date of manufacture

CODESYS 3.5.16.3 19.11.2020

CDSA-D3-RV 1.0.0 12.11.2020

CPX-E-CEC-* Revision 10 03.12.2020

Table 1.1: 1 Components/Software used

Page 6: Application Note Access Keyboard of CDSA-D3-RV

Introduction

Page 6 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

2 Introduction

The handheld CDSA-D3-RV can be used especially within motion control applications. The handheld provides hardware keys to control single axes, etc. This application note describes how to setup a basic CODESYS appli-cation to use the key access within your visualization.

Page 7: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 7 of 19

3 Setup CODESYS Project

3.1 Preparation

To use the handheld within your application some CODESYS packages from Festo must be installed:

• CPX-E-CEC Target support package • CDSA-D3-RV support package (or Festo Robotic Package)

To install the packages, use the CODESYS Package Manager. Start Package Manger within CODESYS (Tools > Packager …), Windows start-menu or via double-click on the files.

All CODESYS packages from are located within Festo Support Portal.

3.2 Create CODESYS Project

Start CODESYS and create a new project. This can be skipped if you want to integrate panel into an existing pro-ject.

Page 8: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Page 8 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

Select a template. In my case I will choose a CPX-E-CEC project. You can choose another controller if you want. Make sure your controller supports the CODESYS Remote Target Visualization (RTV). After setup location and name press OK to continue.

Select matching device version and your basic project will be created.

3.3 Add Library to Project

Select library manager.

Click “Add Library” to open the dialog. Search for “Festo_RTV_Panel_3” or navigate to Application > Festo > Common.

Page 9: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 9 of 19

Select library and press OK to add library to your project.

3.4 Visualization Manager

You need to add the Visualization Manager to your project. This manager adds some parts to your project that are used by the visualization.

Back in the project tree – add manager by right click on Application > Add Object > Visualization Manager

If you want to use “VisuSymbols” activate checkbox. (Symbols can be added later.) After that press the “Add”-button to complete this step.

After inserting Visualization Manager successfully, the manager will be added to your project tree.

Page 10: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Page 10 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

There are several options within the Visualisation Manager. Check CODESYS help for addition information (https://help.codesys.com/webapp/_visu_f_reference_ui_objects_visu_and_visueditor;product=core_visualization;version=3.5.16.0).

3.5 Remote Target Visualization

To use remote target visualization functionality the function has to be added. Right-click on “VisualizationMan-ager” > Add Object.

Confirm opening dialog. CODESYS will prepare your project to use visualization functionality within the project. Therefore a “VISU_TASK” will be added.

For additional information check CODESYS manual too (https://help.codesys.com/webapp/_visu_obj_remote_targetvisu;product=core_visualization;version=3.5.16.0).

If a simulated panel is needed add web-visualization (click “WebVisu…”) too.

Page 11: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 11 of 19

3.6 Create Visualization Page

Add a visualization page to your project by right-click on Application > Add Object > Visualization.

Select a name for your visualization – e.g. “RTVVisualization”.

If a simulation visualization is required, add an additional visualization.

3.7 Setup Start Visualization Page for Remote Target Visualization

Open Remote Target Visualization settings tab by double-clicking on “RemoteTargetvisualization” tree view item.

Press “…” and select your start visualization.

Page 12: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Page 12 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

3.8 Add Keyboard Access to Visualization

Open your visualization page (“RTVVisualization”) and open visualization toolbox. After selecting “Fes-to_RTV_Panel_3” all visualization frames from this library will be shown.

Select “CDSA_D3_RV_Panel” frame and add this to your visualization (with drag-and-drop). After adding this frame, a dialog will appear.

Page 13: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 13 of 19

This dialog shows all input, outputs or references (in-out) of this frame. Like other function blocks within CODESYS in-out-variables have to be setup otherwise a build error occurs.

Input signals:

Parameter Type Description

xBuzzer BOOL Activate buzzer once for a period of time

xRunLED BOOL Activate run LED

xErrorLED BOOL Activate error LED

xPowerLED BOOL Activate power LED

xProgramLED BOOL Activate program LED

xStepLED BOOL Activate step LED

xRebootDevice BOOL Reboot device after a period of time

Table 3.1: Input signals

Reference signals:

Parameter Type Description

stButtons CDSA_D3_RV_BUTTONS Structure contains all button sig-nals. TRUE in case of button pressed.

stPanelInfo FESTO_PANEL_INFO Structure contains some basic in-formation of the connected panel

Table 3.2: Reference signals

All variables can be setup in this dialog as well as in reference setup within the properties tab.

3.9 Map Variables to Frame

Add some variables to connect frame and application. Depending on purpose and variables can be stored in several ways. In this example the “Interface Editor” is used, but a global variable lists can be used also.

Page 14: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Page 14 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

Select frame and map the variables to frame.

3.10 Select Device and run Application

The CODESYS project is now ready to use. Select your device (double-click on Device). Login and download the project to your PLC.

3.11 Add Simulation Frame within Web Visualization

To use CDSA-D3-RV simulation frame add the visualization in the same way as the Remote Target Visualization.

• Add Web Visualization to Visualization Manager (right-click on Visualization Manager > Add Object > WebVisu…)

• Add visualization (right-click on Application > Add Object > Visualization…) • Enter name of visualization • Select start visualisation within web visualisation tab (double-click on WebVisualization > select “…”) • Add simulation frame (CDSA_D3_RV_Emulation) from Visualization Toolbox and map variables

Page 15: Application Note Access Keyboard of CDSA-D3-RV

Setup CODESYS Project

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 15 of 19

• Make sure that your frame is in the correct position. The position is displayed in the position menu with-in the properties tab as well as in the element list. Make sure the values are equal or greater than 0.

• Additional web visualization setup can be done within in the ‘WebVisu’ object. For additional infor-mation check out the CODESYS help (https://help.codesys.com/webapp/_visu_obj_webvisu;product=core_visualization;version=3.5.16.30;language=en).

Page 16: Application Note Access Keyboard of CDSA-D3-RV

Additional

Page 16 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

4 Additional

4.1 Client Handling

CODESYS visualization system can handle multiple clients. Clients could use different technologies, like Remote Target Visualisation (RTV) or Web Visualization. To identify clients the system uses IDs.

4.1.1 Range of IDs

The number of clients can be configured via Visualization Manager. Usually no changes have to be made.

The default value is 100.

The range starts with -1. Each client gets ID -1 when connecting to PLC. During the connection/start-up process this ID usually changes. If the maximum number of visualization clients is exceeded additional clients keep ID -1.

The range of IDs can be accessed within your CODESYS Visualization. Within CODESYS two global constant val-ues are available:

• Visu_Superglobal_Constants.VISU_MIN_NUMBER_OF_CLIENTS • Visu_Superglobal_Constants.VISU_MAX_NUMBER_OF_CLIENTS

The constant values will be defined during compile process.

Use these constant values to create data for each client. Example:

Page 17: Application Note Access Keyboard of CDSA-D3-RV

Additional

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 17 of 19

4.1.2 Access Client ID

Each client gets an ID. With the global constant parameter “CURRENTCLIENTID” the specific client ID can be de-termined.

For testing purpose, the client id can be printed on screen. Create a rectangle and map “CURRENTCLIENTID” as text variable.

After project download to plc the client id is displayed on screen.

Page 18: Application Note Access Keyboard of CDSA-D3-RV

Additional

Page 18 of 19 Application Note – Access Keyboard of CDSA-D3-RV – 1.10

4.1.3 Application usage

Combine the example data with our frames and provide data for each visualization client.

Now these data can be changed foreach client individually. In this example a triggered reboot will affect one specific client only.

4.2 Call Functions within Visualization

When working with client specific data reaction on individual client events may be important. In CODESYS visual-izations it is possible to call functions from visualization elements by events or cyclic.

Function calls within events is common. This example focuses on cyclic function (or method) calls - e.g. to re-fresh data trigger from CDSA-D3-RV hardware keys.

Create a function within CODESYS that gets keyboard data and toggles LEDs based on button states. Return val-ue type should be set to BOOL.

The function should switch on LEDs if jog positive keys are pressed. So, function could look like:

Page 19: Application Note Access Keyboard of CDSA-D3-RV

Additional

Application Note – Access Keyboard of CDSA-D3-RV – 1.10 Page 19 of 19

Now the function should be called cyclically. Therefore, a new rectangle is placed on the visualization. Now the function can be added as state variables flag.

Now in each cycle the function is called. If the function returns TRUE, the rectangle will be invisible.

Note: This example couldn’t handle multiple clients. If you want to use this example with multiple clients extend this program using “CURRENTCLIENTID”.

In addition, when working with functions it’s important to verify the call sequence. Uninitialized Data – especial-ly pointers – could cause exceptions. The call sequence is the same as displayed in the element list.