Subrange types, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 1036

Advertising
background image

L-force | PLC Designer

Programming Reference

1034

DMS 4.1 EN 03/2011 TD29

Implementation:

(* possible: *)
colorvar1 := colors_1.blue;
colorvar2 := colors_2.blue;
(* not possible: *)
colorvar1 := blue;
colorvar2 := blue;

2.

The base data type of the enumeration - which by default is INT - can be explicitly
specified.

Example:
The base data type for enumeration BigEnum should be DINT:

TYPE BigEnum : (yellow, blue, green:=16#8000) DINT;
END_TYPE

Subrange types
A subrange type is a user defined type whose range of values is only a subset of that of
the basic data type. Notice the possibility of using implicit range boundary checks.
The declaration can be done in a DUT object but also a variable can be directly declared
with a subrange type:
Syntax for the declaration as a DUT object:
TYPE <Name> : <Inttype> (<ug>..<og>) END_TYPE;

<Name> must be a valid IEC identifier,

<Inttype> is one of the data types SINT, USINT, INT, UINT, DINT, UDINT, BYTE, WORD, DWORD (LINT,

ULINT, LWORD).

<ug>

Is a constant which must be compatible with the basic type and which sets the lower
boundary of the range types. The lower boundary itself is included in this range.

<og>

Is a constant that must be compatible with the basic type, and sets the upper boundary of
the range types. The upper boundary itself is included in this basic type.


Examples:

TYPE
SubInt : INT (-4095..4095);
END_TYPE

Advertising