EasyManuals Logo

WAGO WAGO-I/O-IPC-C6 User Manual

WAGO WAGO-I/O-IPC-C6
322 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #176 background imageLoading...
Page #176 background image
176 Incorporation of C-Functions as CoDeSys Library WAGO-I/O-SYSTEM 750
758-874/000-131 WAGO-I/O-IPC-C6
Manual
Version 1.0.0
Furthermore, an init-function must be created in the library for each structure
created in CoDeSys. For the file "Beispiel.h", the init-function might look like the
following:
char t_teststructinit(struct t_teststruct *pteststruct, char
bRetain)
{
pteststruct->a = 0;
pteststruct->b = 0;
pteststruct->c = 0;
pteststruct->d = 0;
pteststruct->e = 0;
pteststruct->f = NULL;
return 1;
}
In doing so, the name of the function must be made up of the name of the
structure and the string "init" (e.g., t_teststructinit). The function is called up
one time when CoDeSys is started. It has a pointer to the structure itself as the
transfer parameter and a BOOL value, which is not relevant in this case.
13.2.3 Parameter Transfer by Reference or by Value
It is possible to transfer the parameters by means of reference or by value.
In doing so, it is important that the correct sequence and the data types of the
parameters are used for transferring to the function. For this purpose, the data
types from the table in section "Data types" must be adhered to. If falsely declared
values are accessed within the C program, memory access errors may occur. The
CoDeSys runtime system will then delete (suspend) the access violating task
immediately.
13.3 Additional Applications
It is possible to start any Linux program or script using encapsulation in a C-
function.
C-functions can also, for example, contain an init-function, which generates its
own Linux threads and therefore contains independent programs. These init-
functions can be called up through CoDeSys system events such as PLC-Start or
PLC-Stop. In this way, complete applications can also be encapsulated in their
own thread.
In init-functions, pointers to common data structures, with which a convenient
data interface between CoDeSys and C-applications is made possible, can also be
transferred.
Pos: 47 /Dokumentati on allgemein/Glieder ungselemente/---Seitenwechsel--- @ 3\mod_1221108045078_0.doc @ 21810 @ @ 1

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the WAGO WAGO-I/O-IPC-C6 and is the answer not in the manual?

WAGO WAGO-I/O-IPC-C6 Specifications

General IconGeneral
BrandWAGO
ModelWAGO-I/O-IPC-C6
CategoryI/O Systems
LanguageEnglish

Related product manuals