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

Page 526

Advertising
background image

L-force | PLC Designer

Data types in PLC Designer

524

DMS 3.2 EN 02/2011 TD29



iSize : DINT;

(* Size of pointer access;
the data type must be
integer-compatible and must
cover the maximum potential
data size stored at the
pointer address *)

iGran : DINT;

(*

! not to be used in CheckPointer functions !

:
Granularity of the access,
e.g. "2", if INT is the
smallest not-structured
datatype used on the given
address; the data type must
be integer-compatible *)

bWrite: BOOL;

(*Access type: Read or Write;
TRUE=read access; the data
type must be BOOL *)

END_VAR

If there are a CheckPointer function

and

a CheckPointerAligned function in the project,

CheckPointerAligned will be called.

11.2.4

Enumeration

Enumeration is a user-defined data type that is made up of a number of string
constants. These constants are referred to as enumeration values.

Enumeration values are recognized in all areas of the project even if they were
declared within a POU. It is best to create your enumerations as objects in the Object
Organizer under the register card Data types. They begin with the keyword TYPE

and end with END_TYPE.

Syntax:

TYPE

<Identifier>:(<Enum_0> ,<Enum_1>, ...,<Enum_n>);

END_TYPE

A variable of the type <Identifier> can take on one of the enumeration values and will
be initialized with the first one. These values are compatible with whole numbers

which means that you can perform operations with them just as you would with INT.
You can assign a number x to the variable. If the enumeration values are not
initialized, counting will begin with 0. When initializing, make certain the initial
values are increasing. The validity of the number will be reviewed at the time it is run.

Advertising