Parameter Transfer By Reference Or By Value; Additional Applications - WAGO -I/O-SYSTEM 750 User Manual

Wago-i/o-ipc-c10e 758-875/000-112 canopen master codesys 2.3
Hide thumbs Also See for WAGO-I/O-SYSTEM 750:
Table of Contents

Advertisement

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.,
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 13.2.1 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.
WAGO I/O-SYSTEM 750
I/O-IPC-C10E, CANopen Master
Incorporation of C-Functions as CoDeSys Library
t_teststructinit
). The function is called up
147

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents