Pointer, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 524

Advertising
background image

L-force | PLC Designer

Data types in PLC Designer

522

DMS 3.2 EN 02/2011 TD29



Test Program for the function CheckBounds:

PROGRAM PLC_PRG
VAR
a: ARRAY[0..7] OF BOOL;
b: INT:=10;
END_VAR

a[b]:=TRUE;



Stop!

The CheckBounds-function provided by the Check.Lib library is just a sample
solution! Before using that library module check whether the function is working in
your sense, or implement an appropriate function directly as a POU in your project.

11.2.3

Pointer

Variable or function block addresses are saved in pointers while a program is running.

Pointer declarations have the following syntax:

<Identifier>: POINTER TO <Datatype/Functionblock>;

A pointer can point to any data type or function block even to user-defined types.

The function of the Address Operator ADR is to assign the address of a variable or
function block to the pointer.

A pointer can be dereferenced by adding the content operator "^" after the pointer
identifier.

Note!

A pointer is counted up byte-wise ! You can get it counted up like it is usual in the C-
Compiler by using the instruction p=p+SIZEOF(p^);.

Advertising