beautypg.com

5 references, 6 subrange types, References – Lenze DDS v2.3 User Manual

Page 263: Subrange types, Drive plc developer studio

background image

Drive PLC Developer Studio

IEC 61131-3 Data types

10-7

l

DDS EN 2.3

10.2.5

References

The user-defined data type “ Reference” generates an alternative name for a variable, constant or
function block.

Organize your references as objects in the

Object Organizer on the index card Data types. They

start with the keyword TYPE and end with END_TYPE.

Syntax:

TYPE

: ;

END_TYPE

Example:

TYPE

message:STRING[20];

END_TYPE

;

10.2.6

Subrange types

The value range of a subrange type merely comprises a basic type subset. Declaration may be on
the Data types index card. A variable can also be declared directly with a subrange type.

Syntax for declaration on the Data types index card

TYPE:(..

    ):=Initial value;END_TYPE

    Must be a valid IEC identifier.

    One of the data types SINT, USINT, INT, UINT, DINT, UDINT, BYTE, WORD, DWORD

    Is a constant that must be compatible with the basic type and defines the range type lower limit. The lower limit pertains to
    this range.

      Is a constant that must be compatible with the basic type and defines the range type upper limit. The upper limit pertains to
      this basic type.

      TYPE

      SubInt : INT (-4095..4095);

      END_TYPE

      Direct declaration of a variable with a subrange type.

      Correct specification of an initial value if the subrange does not include 0.

      VAR

      i1 : INT (-4095..4095);
      i2: INT (5..10):=5;
      ui : UINT (0..10000);

      END_VAR

      Error message

      The assigned constant of a subrange type (declaration or implementation) must be within the value
      range as otherwise an error message will be output.

      Show/Hide Bookmarks