23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Enter the name "dummy," set the type to "B&R Automation Basic", and select the resource "Cyclic #8 − [10<br />

ms]". Confirm your selection by clicking Finish.<br />

A new editor window for entering source code for the new task is displayed. Enter the source code seen below<br />

in the image:<br />

Save your input by clicking on the icon in the toolbar and then close the editor window.<br />

These variables now suffice for this example. In an actual project, the variables would not just be assigned to<br />

themselves. Instead, they would normally be used as calculation elements for the control tasks.<br />

We have now created the necessary variables and can move on to the Next Step.<br />

4.2.2.3.2 Inserting a Cyclic Task<br />

Advanced users can use a programming language to insert a cyclic task in the system. The variables to be used<br />

are created according to the programming language which is used. For our example, we will use a simple ANSI<br />

C task. In this programming language, the variables are defined as a part of the source code.<br />

In the following, you can see the necessary C source code which defines the same variables used in the<br />

previous section. For information about integrating an ANSI C task, please refer to the Automation Studio Help.<br />

/* Begin C Source */<br />

#include <br />

#include <br />

_GLOBAL UINT BmpIdx;<br />

_GLOBAL USINT LBCurIdx;<br />

_GLOBAL USINT LBSelIdx;<br />

_GLOBAL USINT LBButtonDown;<br />

_GLOBAL UINT ObjColor;<br />

_INIT void C_Prog_init(void) /* Init procedure */<br />

{<br />

BmpIdx = 0;<br />

LBCurIdx = 0;<br />

LBSelIdx = 0;<br />

LBButtonDown = 0;<br />

ObjColor = 0;<br />

}<br />

_CYCLIC void C_Prog_cycle(void) /* Cyclic procedure */<br />

{<br />

}<br />

/* End C Source */<br />

Once the C task has been inserted, we can proceed to the next step.<br />

4.2.2.4 IPC − Step 4: Applying Global Settings to <strong>Visual</strong> <strong>Components</strong><br />

Introduction to <strong>Visual</strong> <strong>Components</strong> 2.3<br />

If you double−click on the "ipcpanel" panel object in the software view, the <strong>Visual</strong> <strong>Components</strong> editor opens with<br />

the global project options showing.<br />

242 4.2.2.3 IPC − Step 3: Inserting PV Variables

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!