7 real and lreal constants, 8 string constants, 9 type constants (typed literals) – Lenze DDS v2.3 User Manual

Page 287: Real and lreal constants, String constants, Type constants (typed literals), Drive plc developer studio

Advertising
background image

Drive PLC Developer Studio

IEC 61131-3 Operands

13-3

l

DDS EN 2.3

13.1.7

REAL and LREAL constants

REAL

constants may be decimal fractions and exponents

using the American way of decimal points.

Examples:

7.4 (* instead of 7,4 *)
1.64e+009 (* instead of 1,64e+009 *)

13.1.8

STRING constants

A string can be any character sequence.

STRING

constants start and end with single quotes. Umlauts and white spaces are also allowed and

processed like any other character.

In character sequences, the combination of the dollar sign $ followed by two hexadecimal numbers
will be interpreted as hexadecimal representation of the 8 bit character code.

Occurrences in a character sequence of combinations of two characters starting with the dollar sign
will be interpreted as follows:

$$

Dollar sign

$’

Single quote

$L

or $l

Line feed

$N

or $n

New line

$P

or $p

Page feed

$R

or $r

Line break

$T

or $t

Tabulator

Examples:

’Hello’
’Susi and Claus’
’:-)’

13.1.9

Type

constants

(Typed Literals)

As a rule, IEC constants use the lowest possible data type. If a different data type is to be applied,
use Typed Literals without the need of having to explicitly declare the constant.

The constant is given a type-defining prefix.
Notation <Type>#<Literal>

<Type>

specifies the required data type. The type must be written in uppercase.

BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT, DWORD, REAL,
LREAL

<Literal> specifies the constant. The input must be compatible with the data type specified
under <type>.

var1:=DINT#34;

An error message appears if the constant cannot be transferred into the target type without data
loss. Typed literals can be used where normal constants are applied.

Show/Hide Bookmarks

Advertising