User defined data types, Defined data types, Arrays – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 1030: User defined data types 8, L-force | plc designer

Advertising
background image

L-force | PLC Designer

Programming Reference

1028

DMS 4.1 EN 03/2011 TD29

16.2.3

User Defined Data Types

Defined Data Types
Additionally to the standard data types the user can define special data types within a
project.
These definitions are possible via creating DUT (Data Unit Type) objects in the POUs
window resp. within the declaration part of a POU.
Please notice the given recommendations on the naming of objects in order to make it
as unique as possible.
See the following user defined data types:
• ARRAY
• Structure
• Enumeration
• Subrange type
• Reference
• Pointer

Arrays
One-, two-, and three-dimensional fields (arrays) are supported as elementary data
types. Arrays can be defined both in the declaration part of a POU and in the global
variable lists. Notice the possibility of using implicit boundary checks.
Syntax:
<Field_Name>:ARRAY [<ll1>..<ul1>,<ll2>..<ul2>] OF <elem. Type>
ll1, ll2, ll3 identify the lower limit of the field range; ul1, ul2 and ul3 identify the upper
limit. The range values must be integers.
Example:

Card_game: ARRAY [1..13, 1..4] OF INT;


Initializing Arrays:

Attention: In contrast to »PLC Designer« V2.3 now squared brackets must be put
around the initialization part !

Example for complete initialization of an array:

arr1 : ARRAY [1..5] OF INT := [1,2,3,4,5];
arr2 : ARRAY [1..2,3..4] OF INT := [1,3(7)]; (* short for 1,7,7,7 *)
arr3 : ARRAY [1..2,2..3,3..4] OF INT := [2(0),4(4),2,3];
(* short for 0,0,4,4,4,4,2,3 *)

Advertising