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

Page 1098

Advertising
background image

L-force | PLC Designer

Programming Reference

1096

DMS 4.1 EN 03/2011 TD29

Notice the following possibilities of using the dollar sign "$" in string constants:

entered combination

interpretation

$<two hex numbers>

hexadecimal representation of the eight bit character code

$$

Dollar sign

$'

Single quotation mark

$L or $l

Line feed

$N or $n

New line

$P or $p

Page feed

$R or $r

Line break

$T or $t

Tab

Examples:
'w1Wüß?'
' Abby and Craig '
':-)'
'costs ($$)'

Typed Literals
Basically in using IEC constants the smallest possible data type will be used. If another
data type must be used, this can be achieved with the help of typed literals without
the necessity of explicitly declaring the constants.
For this purpose the constant will be provided with a prefix which determines the type.
Syntax:
<Type>#<Literal>
<Type> specifies the desired data type; possible entries are: BOOL, SINT, USINT, BYTE,
INT, UINT, WORD, DINT, UDINT, DWORD, REAL, LREAL. The type must be written in
uppercase letters.
<Literal> specifies the constant. The data entered must fit within the data type
specified under <Type>.

Example:

var1:=DINT#34;

If the constant can not be converted to the target type without data loss, an error
message will be issued.
Typed literals can be used wherever normal constants can be used.

Advertising